UNIX-commands in PHP code?
I have a task to use the UNIX-command tail -10 and read ten rows from a .txt file. This is new for me and I need some help with the code and how it's working?
I have search some and discovered the exec() and want to use this, but how do I read the rows from the .txt file?
Preciate some help! Thanks!
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
No need to do that:
$myfile = 'test.txt';
$lines = file($myfile);
$x = count($lines);
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)