Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,670 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,170 people online right now. Registration is fast and FREE... Join Now!




File lines counting

 
Reply to this topicStart new topic

File lines counting

k0b13r
post 14 Aug, 2007 - 04:34 PM
Post #1


D.I.C Head

Group Icon
Joined: 18 Jul, 2006
Posts: 196



Thanked 1 times

Dream Kudos: 250
My Contributions


Hi. I wanted to ask how I can count lines in file ? Is there any specific function for this ? I was looking for something in php.net manual, but I've found nothing. Or I have to put all lines into array and than use count() function ?
Thanks for answers smile.gif
User is offlineProfile CardPM

Go to the top of the page

snoj
post 14 Aug, 2007 - 04:39 PM
Post #2


$Null

Group Icon
Joined: 31 Mar, 2003
Posts: 3,304



Thanked 5 times

Dream Kudos: 700
My Contributions


One way would be to use file() and count().
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 14 Aug, 2007 - 06:20 PM
Post #3


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,354



Thanked 58 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


If this php code is running on a Linux/Unix machine, simply issue
CODE

$var=system("cat *file* | wc -l ");
echo $var;
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:59AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month