Explode PROBLEM

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Calimero
Forum Contributor
Posts: 310
Joined: Thu Jan 22, 2004 6:54 pm
Location: Milky Way

Explode PROBLEM

Post by Calimero »

explode(" ", $textfield);

This work fine, but ...

I need to explode on this criteria IS IT POSSIBLE?

explode(" some_joker_character some_joker_character ", $textfield);

EXPLANATION: Is there a joker sign, I need to explode the textfield like this: empty space (1 char long) any_word another empty space (1 char long) any_word another empty space (1 char long)

Basicaly the idea is to explode the texfield to get combinations of two words. Is this possible with the explode function and is it possible at all, and how ?

Thanks Ahead !
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]preg_split[/php_man]('# .\b#',$textfield) maybe...

there are no wildcard characters for explode..
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

[php_man]preg_split[/php_man] splits strings along matches regular expression patterns. Try your hands at regular expression, they're complicated, but worthwhile getting into.
Post Reply