Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   PHP: Explode A String With Multiple Delimiters. (http://siteownersforums.com/showthread.php?t=100260)

noahwilson 08-05-2013 04:44 AM

PHP: Explode A String With Multiple Delimiters.
 
We all know about the famous explode() in php, but this function only accepts one delimiter.. so if you want to split a sentence for example using hyphens (-) fullstops (.) and commas (,) and question marks (?), this might be a little bit of a problem, therefore this function will help you to split a string using multiple delimiters.

jordan_rap13 09-26-2013 12:09 PM

try this:

$output = preg_split( "/ (-|.|,|?) /", $input );


All times are GMT -7. The time now is 11:04 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.