Changing a string to an array split every newline
Posted: Wed Oct 15, 2003 7:45 pm
How would I go about making a string that has multiple lines into an array seperated every new line?
Code: Select all
<?php
$string = "This is my string\nAs you can tell,\nit has many new lines.\n";
$array = array();
$array = whatfunction("\n", $string);
$i = 0;
foreach ($array as $split)
{
echo $split[$i];
echo ":::::";
$i++;
}
//Output something like this: This is my string:::::As you can tell......
?>