3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function get_message($data) { if (isset($data['message'])) { $message = $data['message']; } else { $message = 'no message'; } return $message; } function get_message_nullcoalesce($data) { return $data['message'] ?? 'no message'; } function get_message_ternary($data) { return isset($data['message']) ? $data['message'] : 'no message'; } $data = []; echo get_message($data) . "\n"; echo get_message_ternary($data) . "\n"; echo get_message_nullcoalesce($data) . "\n";
based on 2AS7W
Output for hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
no message no message no message
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '?' in /in/aqS5Z on line 14
Process exited with code 255.