3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseQuoteAware(string $commandLine) : array{ $args = []; preg_match_all('/"((?:\\\\.|[^\\\\"])*)"|[~^][^\s~^]*|\S+\s*/u', $commandLine, $matches, PREG_UNMATCHED_AS_NULL); $size = count($matches[0]); for ($k = 0; $k < $size; ++$k) { if ($matches[1][$k] !== null) { $args[] = str_replace('\"', '"', $matches[1][$k]); continue; } $match = $matches[0][$k]; $level = (substr_count($match, "[") - substr_count($match, "]")) + (substr_count($match, "{") - substr_count($match, "}")) + (substr_count($match, "(") - substr_count($match, ")")); if ($level == 0 || $k == $size - 1) { $args[] = rtrim($match); } else { $matches[0][$k + 1] = $match . $matches[0][$k + 1]; } } return $args; } $cmdLine = '/tellraw @a[name="Arie1906", c=1] "quoted \"你好\"" {"rawtext": [{"text":"§bI am blue"}]}'; var_dump(parseQuoteAware($cmdLine));

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.5.00.0120.01120.32
8.4.150.0030.00014.05
8.4.140.0120.01218.11
8.4.130.0110.00918.87
8.4.120.0120.00917.99
8.4.110.0120.01023.95
8.4.100.0130.00718.08
8.4.90.0110.01020.49
8.4.80.0030.00519.76
8.4.70.0390.01118.14
8.4.60.0370.01318.14
8.4.50.0380.00918.14
8.4.40.0370.01218.14
8.4.30.0400.00918.14
8.4.20.0410.00918.14
8.4.10.0370.01118.14
8.3.280.0120.01018.72
8.3.270.0140.00616.80
8.3.260.0120.00816.83
8.3.250.0110.00716.90
8.3.240.0120.00816.87
8.3.230.0060.00216.80
8.3.220.0070.00518.82
8.3.210.0360.00918.14
8.3.200.0320.00718.14
8.3.190.0320.00718.14
8.3.180.0390.00818.14
8.3.170.0350.00818.14
8.3.160.0380.01018.14
8.3.150.0430.01018.14
8.3.140.0400.00918.14
8.3.130.0270.01418.14
8.3.120.0320.01118.14
8.3.110.0300.01018.14
8.3.100.0390.00718.14
8.3.90.0350.01218.14
8.3.80.0350.00918.14
8.3.70.0330.01018.14
8.3.60.0330.00918.14
8.3.50.0360.00718.14
8.3.40.0340.00818.14
8.3.30.0460.00618.14
8.3.20.0360.01318.14
8.3.10.0330.00918.14
8.3.00.0300.00718.14
8.2.290.0130.00616.67
8.2.280.0250.00818.14
8.2.270.0280.00618.14
8.2.260.0310.00818.14
8.2.250.0290.01018.14
8.2.240.0320.00818.14
8.2.230.0300.01318.14
8.2.220.0330.00818.14
8.2.210.0310.00918.14
8.2.200.0290.01018.14
8.2.190.0280.00818.14
8.2.180.0320.00718.14
8.2.170.0300.00618.14
8.2.160.0360.00918.14
8.2.150.0320.01018.14
8.2.140.0350.00918.14
8.2.130.0230.01218.14
8.2.120.0330.01018.14
8.2.110.0290.01318.14
8.2.100.0320.00918.14
8.2.90.0350.00718.14
8.2.80.0370.00818.14
8.2.70.0290.01318.14
8.2.60.0280.01618.14
8.2.50.0370.00518.14
8.2.40.0360.00718.14
8.2.30.0380.00518.14
8.2.20.0330.01018.14
8.2.10.0430.01318.14
8.2.00.0310.00718.14

preferences:
53.26 ms | 403 KiB | 5 Q