3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $privateProperty = "hello"; public function myMethod() { $prop = $this->privateProperty; $map = array_map( function($value) use($this->privateProperty) { return $this->privateProperty." ".$value; }, array( "city", "world", "universe" ) ); return $map; } } $test = new Test(); print_r($test->myMethod());
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Fatal error: Cannot use $this as lexical variable in /in/4YBB9 on line 9
Process exited with code 255.

preferences:
177.66 ms | 1395 KiB | 53 Q