3v4l.org

run code in 300+ PHP versions simultaneously
<?php // a single colon indicates the option takes a value // a double colon indicates the value may be omitted $shortopts = "hf:v::d"; // GNU-style long options are not required $longopts = ["help", "version"]; $opts = getopt($shortopts, $longopts); // options without values are assigned a value of boolean false // you must check their existence, not their truthiness if (isset($opts["h"]) || isset($opts["help"])) { fprintf(STDERR, "Here is some help!\n"); exit; } // long options are called with two hyphens: "--version" if (isset($opts["version"])) { fprintf(STDERR, "%s Version 223.45" . PHP_EOL, $argv[0]); exit; } // options with values can be called like "-f foo", "-ffoo", or "-f=foo" $file = ""; if (isset($opts["f"])) { $file = $opts["f"]; } if (empty($file)) { fprintf(STDERR, "We wanted a file!" . PHP_EOL); exit(1); } fprintf(STDOUT, "File is %s" . PHP_EOL, $file); // options with optional values must be called like "-v5" or "-v=5" $verbosity = 0; if (isset($opts["v"])) { $verbosity = ($opts["v"] === false) ? 1 : (int)$opts["v"]; } fprintf(STDOUT, "Verbosity is %d" . PHP_EOL, $verbosity); // options called multiple times are passed as an array $debug = 0; if (isset($opts["d"])) { $debug = is_array($opts["d"]) ? count($opts["d"]) : 1; } fprintf(STDOUT, "Debug is %d" . PHP_EOL, $debug); // there is no automated w

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0160.00316.75
8.3.50.0040.01118.14
8.3.40.0160.00618.91
8.3.30.0060.00918.83
8.3.20.0040.00421.90
8.3.10.0050.00321.82
8.3.00.0000.00822.33
8.2.180.0060.00918.46
8.2.170.0100.01422.96
8.2.160.0070.01120.52
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0100.00326.16
8.2.120.0050.00226.16
8.2.110.0060.00322.14
8.2.100.0040.00818.03
8.2.90.0040.00417.91
8.2.80.0040.00418.05
8.2.70.0060.00317.90
8.2.60.0000.00918.16
8.2.50.0080.00018.10
8.2.40.0000.00719.48
8.2.30.0030.00519.24
8.2.20.0000.00718.33
8.2.10.0040.00418.89
8.2.00.0040.00419.22
8.1.280.0140.00025.92
8.1.270.0040.00420.87
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00922.18
8.1.230.0070.00420.89
8.1.220.0000.00720.95
8.1.210.0000.00818.79
8.1.200.0030.00617.48
8.1.190.0040.00417.35
8.1.180.0000.00918.10
8.1.170.0040.00420.78
8.1.160.0070.00018.96
8.1.150.0000.00718.95
8.1.140.0000.00818.86
8.1.130.0030.00320.16
8.1.120.0030.00617.48
8.1.110.0000.00817.37
8.1.100.0050.00517.47
8.1.90.0080.00017.39
8.1.80.0040.00417.48
8.1.70.0070.00017.46
8.1.60.0060.00317.52
8.1.50.0000.00917.57
8.1.40.0000.00817.48
8.1.30.0030.00617.56
8.1.20.0030.00517.66
8.1.10.0060.00317.61
8.1.00.0050.00317.54
8.0.300.0040.00419.64
8.0.290.0070.00016.58
8.0.280.0070.00018.53
8.0.270.0000.00817.35
8.0.260.0000.00620.15
8.0.250.0000.00717.01
8.0.240.0030.00317.01
8.0.230.0080.00017.00
8.0.220.0000.00716.99
8.0.210.0000.00717.04
8.0.200.0070.00016.94
8.0.190.0040.00416.93
8.0.180.0030.00516.86
8.0.170.0050.00316.98
8.0.160.0040.00416.87
8.0.150.0030.00416.84
8.0.140.0050.00216.87
8.0.130.0000.00513.45
8.0.120.0040.00416.89
8.0.110.0000.01016.92
8.0.100.0050.00216.82
8.0.90.0060.00316.83
8.0.80.0120.00316.91
8.0.70.0050.00216.97
8.0.60.0000.00816.86
8.0.50.0000.00816.97
8.0.30.0030.01316.86
8.0.20.0050.01417.32
8.0.10.0000.00816.98
8.0.00.0060.01316.93
7.4.330.0020.00215.55
7.4.320.0000.00616.54
7.4.300.0070.00016.63
7.4.290.0050.00216.54
7.4.280.0060.00316.66
7.4.270.0020.00516.63
7.4.260.0000.00513.29
7.4.250.0040.00416.45
7.4.240.0060.00216.53
7.4.230.0040.00416.61
7.4.220.0030.00316.64
7.4.210.0060.00816.57
7.4.200.0040.00416.52
7.4.130.0080.01216.55
7.4.120.0160.00616.47
7.4.110.0160.00316.57
7.4.100.0080.01216.54
7.4.90.0070.01216.54
7.4.80.0140.00419.39
7.4.70.0040.01916.40
7.4.60.0100.00616.52
7.4.50.0100.00316.34
7.4.40.0160.00016.50
7.4.00.0040.01115.21
7.3.330.0080.00016.29
7.3.320.0000.00613.04
7.3.310.0030.00316.21
7.3.300.0030.00316.31
7.3.290.0000.00616.19
7.3.260.0110.00616.35
7.3.240.0100.00716.43
7.3.230.0160.01116.40
7.3.210.0100.00516.27
7.3.200.0190.00016.61
7.3.190.0090.00916.40
7.3.180.0030.01316.42
7.3.170.0090.01116.34
7.3.160.0000.01616.38
7.3.110.0030.01114.85
7.3.100.0030.01315.00
7.3.90.0050.01514.43
7.3.80.0000.01314.91
7.3.70.0140.00014.80
7.3.60.0070.00714.64
7.3.50.0070.00714.80
7.3.40.0030.01014.61
7.3.30.0070.00714.46
7.3.20.0120.00314.94
7.3.10.0150.00014.66
7.3.00.0030.01314.57
7.2.330.0140.00716.43
7.2.320.0070.01016.70
7.2.310.0070.01016.69
7.2.300.0130.01016.58
7.2.290.0090.00616.50
7.2.240.0090.01015.17
7.2.230.0150.00414.89
7.2.220.0070.01414.64
7.2.210.0030.01114.99
7.2.200.0060.00914.71
7.2.190.0080.00614.68
7.2.180.0070.00714.92
7.2.170.0060.00814.89
7.2.160.0040.01114.98
7.2.150.0120.00315.05
7.2.140.0090.00614.97
7.2.130.0150.00714.86
7.2.120.0110.00315.11
7.2.110.0130.00514.98
7.2.100.0160.00015.17
7.2.90.0070.01415.16
7.2.80.0100.01015.24
7.2.70.0100.00715.10
7.2.60.0070.01415.07
7.2.50.0030.01314.97
7.2.40.0000.01614.90
7.2.30.0110.00415.20
7.2.20.0060.01014.90
7.2.10.0110.00615.21
7.2.00.0030.01515.17
7.1.330.0030.01513.86
7.1.320.0080.01113.98
7.1.310.0100.00313.87
7.1.300.0100.00313.78
7.1.290.0030.01013.88
7.1.280.0000.01313.88
7.1.270.0030.01013.61
7.1.260.0060.00813.70
7.1.250.0090.01013.96

preferences:
42.47 ms | 400 KiB | 5 Q