note 53431 deleted from function.explode by bjori

From: Date: Mon, 25 Sep 2006 08:09:33 +0000
Subject: note 53431 deleted from function.explode by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117586@lists.php.net to get a copy of this message
Note Submitter: m_b ---- Here's how to split a text file into lines using explode(). This could be very useful for restoring backed up databases, when you need to pass every line (SQL statement) to MYSQL separatly: $theFile = file_get_contents('file.txt'); $lines = array(); $lines = explode("\n", $theFile); $lineCount = count($lines); for ($i = 0; $i < $lineCount; $i++){ echo $lines[$i]."<hr>"; }//for The text lines are split by a horizontal line so you can see the effect in the browser

« previous php.notes (#117586) next »