note 92446 modified in function.explode by thiago
| From: | thiago@php.net | Date: | Fri, 24 Jul 2009 14:35:34 +0000 |
| Subject: | note 92446 modified in function.explode by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158691@lists.php.net to get a copy of this message | ||
If you are going to use foreach after explode(), call reset() before foreach:
<?php
$arr = explode("\n", 'test \n test2 \n test3');
reset($arr);
foreach($arr as $line)
{ /* do something */ ; }
?>
--was--
If you are going to use foreach after explode(), call reset() before foreach:
$arr = explode("\n", 'test \n test2 \n test3');
reset($arr);
foreach($arr as $line)
{ /* do something */ ; }
http://php.net/manual/en/function.explode.php