I've been having a load of trouble with the substr function, and I'm starting to think I am mis-using it.
PHP Code:
$code = '
Events <br />
Time - Elapsed game time is 300.00 seconds <br />
Conditions <br />
Actions <br />';
$nextline = strpos($code,'<br />');
while ( $nextline ){
$line = substr($code,0,$nextline);
echo '1LINE ' . $line . '<br />'; // TESTING
$code = substr($code,$nextline);
echo '1CODE ' . $code . '<br />'; // TESTING
$nextline = strpos($code,'<br />');
echo 'NEXTLINE ' . $nextline . '<br />'; // TESTING
}
It works the first time around, but only the first time. On the second the nextline is set to 0 and the loop ends. My only guess is that substr removes "<br />"'s from a string, if thats the case, how can I prevent that?