After upgrade my VPS to PHP 7.2, my website have this error:
PHP Deprecated: Function create_function() is deprecated in /home/nickname/public_html/framework/web/CHttpRequest.php on line 968
and the code at this file its:
usort($languages,create_function('$a,$b','if($a[0]==$b[0]) {return 0;} return ($a[0]<$b[0]) ? 1 : -1;'));
I'm not sure how to fix it, please help me, thanks!
Should be as simple as replacing the function call with an anonymous function.
usort($languages, function($a, $b) {
if($a[0] == $b[0]) {
return 0;
}
return $a[0] < $b[0] ? 1 : -1;
});
You can use the create_function as the callback function for earlier versions of php but now the create_function has been deprecated from the php7.2 and you need to use an anonymous function as @Alex Barker mentioned. Here is the link where you can see the deprecated function create_function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With