PHP 7.3 PHP Deprecated: Function create_function() is deprecated

127 Views Asked by At

I updated my php vesrion from 5.6 to 7.3 and now it showing an error PHP Deprecated: Function create_function() is deprecated in magiczoomplus/magiczoomplus.module.core.class.php on line 78

my code is given below

'restore-speed' => create_function('&$params', 'return $params->checkValue("restore-speed","-1")?$params->getValue("expand-speed"):$params->getValue("restore-speed");') ));

How do I rewrite my code above for PHP 7.3?

I checked on internet and I didn't get any solutions. I need replace code on php 7.3

2

There are 2 best solutions below

0
Sadi4U On

I am not 100% sure about the method of code you use in PHP, but mysql code has been replaced with mysqli

According to this you should put it in a variable

$this->code=create_function(/some code/);

I use the mysqli_query and are still changing codes of older files.

Hope this put you on the correct path.

0
Krystian Podemski On
'restore_speed' => function ($params) {
    return $params->checkValue("restore-speed", "-1") ? $params->getValue("expand-speed") : $params->getValue("restore-speed");
},

It could be something like this :)