3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myTapFunction($value) { tempFn($value); return $value; } function tempFn($value) { return $value->increment(5); } class Test { public $val = 0; public function increment($val) { $this->val += $val; } } $a = new Test(); var_dump( myTapFunction($a) );
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.15, 8.5.0
object(Test)#1 (1) { ["val"]=> int(5) }

preferences:
69.34 ms | 406 KiB | 5 Q