3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = null; print $a ?? 'b'; print "\n"; print $a ?: 'b'; print "\n"; print $c ?? 'a'; print "\n"; print $c ?: 'a'; print "\n"; $b = array('a' => null); print $b ?? 'c'; print "\n"; print $b ?: 'c'; print "\n"; print $b['a'] ?? 'd'; print "\n"; print $b['a'] ?: 'd'; print "\n"; print $b['c'] ?? 'e'; print "\n"; print $b['c'] ?: 'e'; print "\n"; print true ?? 'f'; print "\n"; print false ?: 'g'; print "\n";
based on Z6U2M
Output for hhvm-3.11.1 - 3.21.3, 7.0.0 - 7.3.0
b b a Notice: Undefined variable: c in /in/na1XN on line 14 a Notice: Array to string conversion in /in/na1XN on line 18 Array Notice: Array to string conversion in /in/na1XN on line 21 Array d d e Notice: Undefined index: c in /in/na1XN on line 33 e 1 g
Output for hhvm-3.22.0
b b a Notice: Undefined variable: c in /in/na1XN on line -1 a Notice: Array to string conversion in /in/na1XN on line -1 Array Notice: Array to string conversion in /in/na1XN on line -1 Array d d e Notice: Undefined index: c in /in/na1XN on line -1 e 1 g
Output for hhvm-3.10.1
Fatal error: syntax error, unexpected '?' in /in/na1XN on line 5
Process exited with code 255.
Output for 5.3.21 - 5.6.38
Parse error: syntax error, unexpected '?' in /in/na1XN on line 5
Process exited with code 255.