[ACCEPTED]-Function split() is deprecated" in PHP?-split
http://php.net/manual/en/function.split.php
From the manual
Warning This function has 9 been DEPRECATED as of PHP 5.3.0. Relying 8 on this feature is highly discouraged
Note:
As 7 of PHP 5.3.0, the regex extension is deprecated 6 in favor of the PCRE extension. Calling 5 this function will issue an E_DEPRECATED 4 notice. See the list of differences for 3 help on converting to PCRE.
I guess you're 2 supposed to use the alternative preg_split()
. Or if 1 you're not using a regex, just use explode
split has been replaced with explode
, see http://php.net/explode for 5 more information. Works the same as split, but 4 split is 'deprecated' basically means that 3 is a old function that shouldn't be used 2 anymore, and is not likely to be in later 1 versions of php.
Use following explode function:
$command = explode(" ", $tag[1]);
This is the 2 standard solution for this case. Its Perfectly 1 working.
Ahh, the docs says about it. And the docs also 2 say which functions should be used instead 1 of this:
Because the function has been deprecated? You 5 can customize the error_reporting level 4 to not log / display the depreciated errors. But 3 it would be more prudent to just correct 2 the issue (IE use explode instead for the 1 simple split you are doing above.)
You can use this custom function for old 1 codes:
if (!function_exists('split')) {
function split($pattern, $subject, $limit=-1, $flags=0){
return preg_split($pattern, $subject, $limit, $flags);
}
}
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.