Entry
How and you split string into different arrays and save what they were split on?
Feb 26th, 2008 00:02
dman, Jeroen Keppens, Cinley Rodick, brendan conroy, http://www.ttnr.org
<?
// First method
$fruit = "apple,orange,pear";
$fruit_array = explode(",", $fruit);
// values in $fruit_array
// $fruit_array[0] = "apple"
// ... [1] = "orange"
// ... [2] = "pear"
// Second method
$fruit = "apple,orange,pear";
$fruit_array = split(",", $fruit);
// values in $fruit_array
// $fruit_array[0] = "apple"
// ... [1] = "orange"
// ... [2] = "pear"
// Split can use regular expressions in the pattern
?>
hope this answers your question!
Jeroen