After upgrading PHP to 8.0, Fatal error: Uncaught Error: Call to undefined function create_function() solution was reported.

After upgrading PHP to 8.0, Fatal error: Uncaught Error: Call to undefined function create_function() solution was reported.

Because php8.0 has removed create_function. So there are 2 solutions.

One. Change the create_function to an anonymous function. As shown below

 <?php $newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);'); echo $newfunc(2, M_E). "\n"; ?>

change to

 <?php $newfunc = function($a,$b) {

The post After upgrading PHP to 8.0, reported Fatal error: Uncaught Error: Call to undefined function create_function() solution. first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8956
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment