3v4l.org

run code in 300+ PHP versions simultaneously
<?php function escapeArgument($argument) { //Fix for PHP bug #43784 escapeshellarg removes % from given string //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows //@see https://bugs.php.net/bug.php?id=43784 //@see https://bugs.php.net/bug.php?id=49446 if ('\\' === DIRECTORY_SEPARATOR) { if ('' === $argument) { return escapeshellarg($argument); } $escapedArgument = ''; $quote = false; foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) { if ('"' === $part) { $escapedArgument .= '\\"'; } elseif (self::isSurroundedBy($part, '%')) { // Avoid environment variable expansion $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%'; } else { // escape trailing backslash if ('\\' === substr($part, -1)) { $part .= '\\'; } $quote = true; $escapedArgument .= $part; } } if ($quote) { $escapedArgument = '"'.$escapedArgument.'"'; } return $escapedArgument; } return escapeshellarg($argument); } var_dump(escapeArgument('./vargant.sh'));

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)
7.0.70.0170.07019.90
7.0.60.0130.06719.93
7.0.50.0130.08020.26
7.0.40.0100.07720.07
7.0.30.0170.06720.11
7.0.20.0070.04720.04
7.0.10.0030.08720.04
7.0.00.0130.07720.13
5.6.280.0000.06720.86
5.6.250.0130.04020.59
5.6.240.0130.08020.70
5.6.230.0100.04020.63
5.6.220.0130.03720.54
5.6.210.0030.08020.57
5.6.200.0000.08021.02
5.6.190.0200.07021.09
5.6.180.0030.06721.03
5.6.170.0100.05021.14
5.6.160.0100.06321.06
5.6.150.0070.07721.09
5.6.140.0100.07321.02
5.6.130.0070.08020.96
5.6.120.0030.07021.13
5.6.110.0070.08021.01
5.6.100.0000.09721.16
5.6.90.0070.08721.16
5.6.80.0170.03720.50
5.6.70.0130.04720.39
5.6.60.0070.08020.33
5.6.50.0030.04320.50
5.6.40.0070.04320.47
5.6.30.0030.05020.43
5.6.20.0130.03020.37
5.6.10.0030.04020.45
5.6.00.0030.04020.35
5.5.380.0100.08020.33
5.5.370.0030.05320.39
5.5.360.0030.04720.36
5.5.350.0030.07320.37
5.5.340.0000.05720.89
5.5.330.0130.07320.84
5.5.320.0070.09020.84
5.5.310.0000.07320.82
5.5.300.0030.07720.91
5.5.290.0070.07320.86
5.5.280.0070.08020.85
5.5.270.0070.08720.73
5.5.260.0100.08320.93
5.5.250.0100.08720.70
5.5.240.0100.07020.28
5.5.230.0030.07720.29
5.5.220.0130.03720.15
5.5.210.0070.07320.18
5.5.200.0000.04320.28
5.5.190.0030.04320.19
5.5.180.0130.03320.21
5.5.160.0070.03720.18
5.5.150.0070.03720.28
5.5.140.0100.05320.07
5.5.130.0030.04020.21
5.5.120.0030.04020.21
5.5.110.0070.03720.03
5.5.100.0030.04020.04
5.5.90.0070.03720.17
5.5.80.0030.04020.16
5.5.70.0000.04320.09
5.5.60.0070.03020.07
5.5.50.0100.03720.06
5.5.40.0070.03719.96
5.5.30.0100.03319.95
5.5.20.0030.06020.06
5.5.10.0100.02720.09
5.5.00.0030.04320.05

preferences:
131.21 ms | 1398 KiB | 7 Q