PHP is telling me that split is deprecated, what's the alternative method I should use?
explode is the alternative. However, if you meant to split through a regular expression, the alternative is preg_split instead.
Str_split or preg_split if you need to split by regular expressions. Explode if you need to split by something simple.
Also for the future, if you ever want to know what PHP wants you to use if something is depreciated you can always check out the function in the manual and it will tell you alternatives.
split is deprecated since it is part of the family of functions which make use of POSIX regular expressions; that entire family is deprecated in favour of the PCRE (preg_*) functions.
If you do not need the regular expression functionality, then explode is a very good choice (and would have been recommended over split even if that were not deprecated), if on the other hand you do need to use regular expressions then the PCRE alternate is simply preg_split.
You can use easier preg_match instead...better and faster all of those ones...
$var = "Get this var" preg_match("/(.*)<\/tag>/", $var , $new_var); echo $new_var['1']; => Get this var
Yes, I would use explode or you could use:
preg_split
Which is the advised method with PHP 6. preg_split Documentation