3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function fun1(){ static $var = 1; return $var++; } public function fun2(){ echo preg_replace_callback('/.*/', function($find){return $this->fun1().$find[0];}, 't'); } } $t = new Test; $t->fun2(); echo 3;

preferences:
34.11 ms | 402 KiB | 5 Q