Jump to content

Problems with explode and array..


Gazan

Recommended Posts

I just have.

 

That is all the code you need.

 

I'll break it down a little more...

$arrWords=explode(' ',$str);

INPUT

' ' ... This is what we're using as the split point - in this case, a space

$str ... a string containing the words we want to split

 

OUTPUT

$arrWords ... an array

 

You can output the words using a simple loop:

foreach ($arrWords as $key => $word) {
  echo $key.' = '.$word.'<br />';
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.