note 5447 deleted from function.explode by jimw

From: Date: Fri, 07 Dec 2001 21:11:20 +0000
Subject: note 5447 deleted from function.explode by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21992@lists.php.net to get a copy of this message
I was trying to add items from a file into a database, but there were commas in some of the records. I got it to work by:<BR> while (!(feof($fp) ) ) {<BR> $buffer = fgets($fp, 4096);<BR> print "before: ".$buffer ;<BR> $buffer = ereg_replace( '","' , '"|"' , $buffer);<BR> $eachword = explode("|" , $buffer);<BR> for ($k=0; $k<count($eachword); $k++) {<BR> print "word $k =$eachword[$k]";<BR> }<BR> <BR> I am looking specificaly for the quote comma quote and changed it to something else for the explode to work.

« previous php.notes (#21992) next »