Jump to content

[SOLVED] would preg_replace be easiest for this?


scarhand

Recommended Posts

say i have a string like this:

 

"joe samson is an elf - rpg gamers"

 

and i want to get "joe samson" and "an elf" out of the string

 

so

$name = "joe samson"

$class = "an elf"

 

now the name and the class will vary. also, they could be more than 1 or 2 words in length each.

 

i need help extracting this:

 

"(a) is (b) - rpg gamers"

 

$name = (a)

$class = (b)

 

would preg_replace be best for this? can i get some examples?

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.