3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function argv() { $GLOBALS["argv"] = func_get_args(); $GLOBALS["argc"] = count($_SERVER["argv"]); } var_dump($argv); $GLOBALS['argv'] = array(); $GLOBALS['argc'] = 0; argv("script.php", "-fvalue", "-h"); var_dump($argv); $options = getopt("f:hp:"); var_dump($options);
Output for 4.3.2 - 5.6.28, 7.0.0 - 7.1.0
array(1) { [0]=> string(9) "/in/SbNWC" } array(3) { [0]=> string(10) "script.php" [1]=> string(7) "-fvalue" [2]=> string(2) "-h" } array(0) { }
Output for hhvm-3.10.0 - 3.12.0
array(1) { [0]=> string(9) "/in/SbNWC" } array(3) { [0]=> string(10) "script.php" [1]=> string(7) "-fvalue" [2]=> string(2) "-h" } array(2) { ["f"]=> string(5) "value" ["h"]=> bool(false) }
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: argv in /in/SbNWC on line 12 NULL array(3) { [0]=> string(10) "script.php" [1]=> string(7) "-fvalue" [2]=> string(2) "-h" } array(0) { }