3v4l.org

run code in 300+ PHP versions simultaneously
<?php function WTF($arg) { // Payload: count the number of its own calls global $c; ++$c; // payload could be anything // use global to extract values global $collection; if (!isset($collection)) { $collection = []; } $collection[] = $arg; // also possible // $r = __FUNCTION__; // return $r(...) return __FUNCTION__; } WTF(1)(2)(4)(8)(16); echo "WTF was called $c times\n"; print_r($collection); ?>
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
WTF was called 5 times Array ( [0] => 1 [1] => 2 [2] => 4 [3] => 8 [4] => 16 )

preferences:
48.98 ms | 854 KiB | 4 Q