Hey guys, I am trying to tokenize a string into an array, can someone take what I have now and show me how to do this?
<?php
$string = "This is an example string";
$tok = strtok($string," ");
while ($tok) {
echo "$tok<br>";
$tok = strtok(" ");
}
?>
this outputs:
This
is
an
example
string
I would like all of those words to be put into an array but I can't figure it out.
Thanks,
Ben LeMasurier