3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function func($str) { echo $str; } } $c = new C(); $sq = 'hoge'; $dq = "hoge"; $fn = 'func' $C->func('beta'); $C->func($sq); $C->func($dq); $C->$fn('beta'); $C->$fn($sq); $C->$fn($dq);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected '$C' (T_VARIABLE) in /in/IjLYV on line 16
Process exited with code 255.

preferences:
162.44 ms | 1395 KiB | 36 Q