sandy1028 Posted August 23, 2007 Share Posted August 23, 2007 Hi, Please tell me how to count the number of columns in text file.... $lines='db.txt'; foreach ($lines as $line) { $text_line = explode(":" , $line); Link to comment https://forums.phpfreaks.com/topic/66337-count-columns/ Share on other sites More sharing options...
MadTechie Posted August 23, 2007 Share Posted August 23, 2007 $text_line = explode(":" , $line); $X = count($text_line); //<--$X will be the columns so for the whole file $X = 0; $lines='db.txt'; foreach ($lines as $line) { $text_line = explode(":" , $line); $X = $X+ count($text_line); } echo "$X: columns "; Link to comment https://forums.phpfreaks.com/topic/66337-count-columns/#findComment-331855 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.