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 false ?? 'f'; print "\n"; print false ?: 'f'; print "\n";
based on apAIb
Output for 7.0.0 - 7.2.0
b b a Notice: Undefined variable: c in /in/UtXLa on line 14 a Notice: Array to string conversion in /in/UtXLa on line 18 Array Notice: Array to string conversion in /in/UtXLa on line 21 Array d d e Notice: Undefined index: c in /in/UtXLa on line 33 e f
Output for 5.3.21 - 5.6.28
Parse error: syntax error, unexpected '?' in /in/UtXLa on line 5
Process exited with code 255.