leke Posted April 8, 2011 Share Posted April 8, 2011 Hi, Is there a way to supply multiple arguments to explode()? I tried: $form_submission = "asdf. ,asdf!? asdf"; $splitSubmission = explode((" ", ".", ",", "!", "?") $form_submission); ...but get a parse error. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/233147-supplying-multiple-agrs-to-explode/ Share on other sites More sharing options...
Pikachu2000 Posted April 8, 2011 Share Posted April 8, 2011 explode Quote Link to comment https://forums.phpfreaks.com/topic/233147-supplying-multiple-agrs-to-explode/#findComment-1199028 Share on other sites More sharing options...
dcro2 Posted April 8, 2011 Share Posted April 8, 2011 Basically, no you can't. But you could first replace all of those with a specific character, like '#'. Then explode by that. $characters = array(" ", ".", ",", "!", "?"); $splitSubmission = str_replace($characters, "#", $form_submission); $splitSubmission = explode("#", $splitSubmission); Quote Link to comment https://forums.phpfreaks.com/topic/233147-supplying-multiple-agrs-to-explode/#findComment-1199030 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.