PHP Issue :: preg_split instead of explode function
If the need is to parse a string and extract the words. Then its advisable to use preg_split instead of using the explode function.
Code follows :
This option works far better than the explode(" ", $textInput).
Code follows :
where the first argument is the regular expression for finding one or more spaces and the second argument is the input text.preg_split ("/\s+/",$textInput);
This option works far better than the explode(" ", $textInput).
Comments