3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function optional(?string $string = null) { } function not_optional(string $string = null) { } optional(); not_optional();
based on POhdI
Output for hhvm-3.21.3 - 3.22.0, 7.1.0 - 7.3.0beta1
Output for hhvm-3.18.5
Fatal error: Uncaught Error: Syntax only allowed in Hack files (<?hh) or with -v Eval.EnableHipHopSyntax=true in /in/P6EdP:5 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/P6EdP on line 3 Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/P6EdP on line 5
Process exited with code 255.