3v4l.org

run code in 300+ PHP versions simultaneously
<?php // https://gist.github.com/TazeTSchnitzel/33cf828bfa306b1b1d2187a6de639375 function fn(&$obj) { return new class($obj) { private $obj; public function __construct(&$obj) { $this->obj = &$obj; } public function __call(string $fn_name, array $fn_args):self { $this->obj = $fn_name(...$fn_args); return $this; } }; } $nama = 'anovsiradj'; echo $nama, PHP_EOL; fn($nama) ->str_replace('a', '4', $nama) ->str_replace('i', '1', $nama) ->str_replace('o', '0', $nama) ->str_rot13($nama) ->md5($nama); echo $nama;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Parse error: syntax error, unexpected token "fn", expecting "(" in /in/u0TEq on line 4
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Parse error: syntax error, unexpected 'fn' (T_FN), expecting '(' in /in/u0TEq on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33
anovsiradj c7467860d30d453769755f341cdd19c0

preferences:
81.63 ms | 409 KiB | 5 Q