How to rewrite an example without the use of create_function?

前端 未结 1 1102
轻奢々
轻奢々 2021-01-18 19:33

When looking at PHP\'s create_function it says:

If you are using PHP 5.3.0 or newer a native anonymous function should be used instead.

1条回答
  •  被撕碎了的回忆
    2021-01-18 20:17

    $newfunc = function($a, $b) {
        return "ln($a) + ln($b) = " . log($a * $b);
    }
    
    echo $newfunc(2, M_E) . "\n";
    

    0 讨论(0)
提交回复
热议问题