3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Hack declaration function _expr($v) { return $v; } $_expr = '_expr'; // Our playground define('qwe', 'asd'); define('zxc', 5); $a=3; $b=4; function c($a, $b) { return $a+$b; } // Usage echo "pre {$_expr(1+2)} post\n"; // outputs 'pre 3 post' echo "pre {$_expr(qwe)} post\n"; // outputs 'pre asd post' echo "pre {$_expr(c($a, $b)+zxc*2)} post\n"; // outputs 'pre 17 post' // General syntax is {$_expr(...)}

preferences:
24.83 ms | 404 KiB | 5 Q