PHP 8.5.0 Alpha 4 available for testing

Voting

: one plus one?
(Example: nine)

The Note You're Voting On

sergey dot nevmerzhitsky at gmail dot com
8 years ago
Prior PHP 7.0 you can use this code:

<?php
$cl
= function($add) { return $this->a + $add; };

$cl->bindTo($newthis);
return
call_user_func_array($cl, [10]);
?>

But this bind the closure permanently! Also read the article for Closure::bindTo() about binding closures from static context.

<< Back to user notes page

To Top