Is there a built in function which will split a word into an array.
I assume you mean into an array of characters. It's one of the examples, right in the manual:
$str = 'string'; $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); print_r($chars);
hello bizz I myself am very new to PHP and I am surprised at myself for even attempting to answer someone else's question but here goes nothing. You want to split a word up into an array do you mean put each letter of the word into an array. I think you need to use the explode() function it takes a string and based on a separator puts the parts into an array. if no sense give me an example of what you are trying to do
benG
Thanks for your help guys. I know of the explode function, but this is just on the fly so I dont have a seperator.
You can address characters in a string as array elements, too:
$str = 'hello world';
echo $str[1]; //echoes 'e'
But maybe in such a case php will provide a warning.