3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(error_reporting^E_NOTICE); $path = "/var/www/foo"; var_dump($pаth."/user/supplied/path"); // prints /user/supplied/path, and emits a notice // let's write a secure random number generator function crypto_rnd() { $rnd = mt_rand(0, 1e30); // 3v4l apparently doesn't have openssl_random_pseudo_bytes $today = date('c'); // extra entropy can't hurt! return hash("sha512", $r⁠nd.$today); // oops, that's actually r\u2060nd, which is undefined, // i.e. NULL, and the result depends only on the current time... } var_dump(crypto_rnd() === crypto_rnd()); // bool(true)... uh oh $foo = 1; var_dump($foo === $foо); // bool(false)... $x = 2; var_dump($x+$⁠x); // int(2)
Output for 7.2.0 - 7.2.13, 7.3.0 - 7.3.1
Warning: Use of undefined constant error_reporting - assumed 'error_reporting' (this will throw an Error in a future version of PHP) in /in/9Bej0 on line 3 Warning: A non-numeric value encountered in /in/9Bej0 on line 3 Notice: Undefined variable: pаth in /in/9Bej0 on line 6 string(19) "/user/supplied/path" Notice: Undefined variable: r⁠nd in /in/9Bej0 on line 12 Notice: Undefined variable: r⁠nd in /in/9Bej0 on line 12 bool(true) Notice: Undefined variable: foо in /in/9Bej0 on line 18 bool(false) Notice: Undefined variable: ⁠x in /in/9Bej0 on line 21 int(2)
Output for 7.1.0 - 7.1.25
Notice: Use of undefined constant error_reporting - assumed 'error_reporting' in /in/9Bej0 on line 3 Warning: A non-numeric value encountered in /in/9Bej0 on line 3 Notice: Undefined variable: pаth in /in/9Bej0 on line 6 string(19) "/user/supplied/path" Notice: Undefined variable: r⁠nd in /in/9Bej0 on line 12 Notice: Undefined variable: r⁠nd in /in/9Bej0 on line 12 bool(true) Notice: Undefined variable: foо in /in/9Bej0 on line 18 bool(false) Notice: Undefined variable: ⁠x in /in/9Bej0 on line 21 int(2)
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20
Notice: Use of undefined constant error_reporting - assumed 'error_reporting' in /in/9Bej0 on line 3 Notice: Undefined variable: pаth in /in/9Bej0 on line 6 string(19) "/user/supplied/path" Notice: Undefined variable: r⁠nd in /in/9Bej0 on line 12 Notice: Undefined variable: r⁠nd in /in/9Bej0 on line 12 bool(true) Notice: Undefined variable: foо in /in/9Bej0 on line 18 bool(false) Notice: Undefined variable: ⁠x in /in/9Bej0 on line 21 int(2)
Output for 5.0.4 - 5.0.5, 5.1.1
Notice: Use of undefined constant error_reporting - assumed 'error_reporting' in /in/9Bej0 on line 3 Notice: Undefined variable: pаth in /in/9Bej0 on line 6 string(19) "/user/supplied/path"
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/9Bej0 on line 21
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
Notice: Use of undefined constant error_reporting - assumed 'error_reporting' in /in/9Bej0 on line 3 Notice: Undefined variable: pаth in /in/9Bej0 on line 6 string(19) "/user/supplied/path"
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant error_reporting - assumed 'error_reporting' in /in/9Bej0 on line 3 Notice: Undefined variable: pаth in /in/9Bej0 on line 6 string(19) "/user/supplied/path"

preferences:
188.67 ms | 401 KiB | 232 Q