Jump to content

PHP Substring


sepoto

Recommended Posts

My substring function is returning a syntax error yet I see nothing of the kind. Thanks!$fh = fopen("sportsbars.csv", 'r') or die("Failed to create file");$entries = 0;$eachline = array();while($line=fgets($fh)){ $eachline[$entries] = $line; echo $eachline[$entries], "\r"; $entries++;}$startatline = 0;while($startatline <= $eachline){ $findpos = strpos($eachline[$startatline], '\t'); substr(strpos($eachline[$startatline], 0, $findpos);}

Link to comment
Share on other sites

My substring function is returning a syntax error yet I see nothing of the kind. Thanks!$fh = fopen("sportsbars.csv", 'r') or die("Failed to create file");$entries = 0;$eachline = array();while($line=fgets($fh)){ $eachline[$entries] = $line; echo $eachline[$entries], "\r"; $entries++;}$startatline = 0;while($startatline <= $eachline){ $findpos = strpos($eachline[$startatline], '\t'); substr(strpos($eachline[$startatline], 0, $findpos);}
Nevermind! Just caught it. strpos. Thanks.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...