I want to take a field consisting of an english phrase (variable length) and split it into several fields, one for each English word, ie a string of variable length bounded by spaces. I've searched the PHP manual and found several functions that I need once the field is split up, but no clues as to how to split up the field. Ideas welcome!
Ummmmm...maybe I'm misunderstanding, but what about split()?
$string = "This is some string"; $foo = array(); $foo = split($string);
echo $foo[0] . "\n"; echo $foo[1] . "\n"; echo $foo[2] . "\n";
hi,
you can use explode() function for the same.
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza);
regards,
Yes, you understood perfectly , many thanks