3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Lambda { private $limit = 5; public function getLimit() { return $this->limit; } } $lambda = new Lambda(); $closure = function() { $this->limit+= 5; }; $closure->call($lambda); echo $lambda->limit;
based on Dbi4l
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access private property Lambda::$limit in /in/4YNde:18 Stack trace: #0 {main} thrown in /in/4YNde on line 18
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Call to undefined method Closure::call() in /in/4YNde on line 17
Process exited with code 255.