3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP $list = [ // an array list of string/regex that i want to check "lorem ipsum", // a words "example", // another word "/(nulla)/", // a regex "/[,.]/", // illustrate regex offset ]; $input_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer quam ex, vestibulum sed laoreet auctor, iaculis eget velit. Donec mattis, nulla ac suscipit maximus, leo metus vestibulum eros, nec finibus nisl dui ut est. Nam tristique varius mauris, a faucibus augue."; // get matches and offset $match_count = 0; $matches = []; foreach($list as $v) { // make pattern from strings not enclosed in delimiters $pattern = $v[0] == '/' ? $v : "/".preg_quote($v, "/")."/i"; // using preg_match_all to get each match and offset if(preg_match_all($pattern, $input_string, $out, PREG_OFFSET_CAPTURE)) { foreach($out[0] AS $m) { echo $m[0]." matched at offset ".$m[1]."!\n"; } } }

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.4.140.0120.00917.97
8.4.130.0100.01019.02
8.4.120.0070.01423.93
8.4.110.0160.00420.83
8.4.100.0030.00519.02
8.4.90.0120.00720.61
8.4.80.0150.00618.97
8.4.70.0060.01318.81
8.4.60.0070.00418.84
8.4.50.0140.00622.48
8.4.40.0160.00724.48
8.4.30.0000.00819.02
8.4.20.0060.00319.82
8.4.10.0060.00323.88
8.3.270.0110.01116.84
8.3.260.0120.00716.89
8.3.250.0040.00419.08
8.3.240.0130.00617.26
8.3.230.0050.00416.66
8.3.220.0090.00718.98
8.3.210.0090.00617.05
8.3.200.0100.00116.73
8.3.190.0120.00717.36
8.3.180.0100.00918.47
8.3.170.0110.00419.13
8.3.160.0140.00418.48
8.3.150.0180.00020.61
8.3.140.0030.01616.82
8.3.130.0110.00416.94
8.3.120.0080.00020.54
8.3.110.0060.00318.72
8.3.100.0070.00316.86
8.3.90.0050.00326.77
8.3.80.0040.00416.88
8.3.70.0090.00618.66
8.3.60.0100.00618.43
8.3.50.0070.01418.60
8.3.40.0180.00320.08
8.3.30.0120.00618.91
8.3.20.0070.00024.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.290.0150.00420.32
8.2.280.0110.00918.84
8.2.270.0100.01017.05
8.2.260.0040.01518.45
8.2.250.0120.00316.99
8.2.240.0000.00917.32
8.2.230.0100.01320.94
8.2.220.0040.00424.06
8.2.210.0050.00326.77
8.2.200.0100.00018.79
8.2.190.0100.00616.75
8.2.180.0120.00325.92
8.2.170.0100.00619.09
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0070.00026.16
8.2.110.0100.00020.38
8.2.100.0000.00920.41
8.1.330.0070.00422.11
8.1.320.0110.00818.16
8.1.310.0100.00018.52
8.1.300.0080.00016.79
8.1.290.0000.00930.84
8.1.280.0030.01225.92
8.1.270.0040.01222.32
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0100.00018.76
8.1.230.0070.00418.93

preferences:
66.48 ms | 403 KiB | 5 Q