3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Finding Floats in an Array */ $arr = [ // Short String '123', // Long String '123 and another float at the end 123.23', // Mixed String '4.7 + 99 / 8...8 00.b', // Float 123.444, // Decimal 444, ]; $pattern = '%(\d+)?\.\d+%'; var_dump(preg_grep($pattern, $arr)); /* Find occurrences of either a space at the start of the string or a "ing" word */ $arr2 = [ "Examine she brother prudent add day ham.\n Far stairs now coming bed oppose hunted become his. You zealously departure had procuring suspicion. Books whose front would purse if be do\n decay. Quitting you way formerly disposed perceive ladyship are. Common turned boy direct and yet.", "Behind sooner dining so window excuse he summer. \n Breakfast met certainty and fulfilled propriety led. Waited get either are wooded little her. Contrasted unreserved as mr particular\n collecting it everything as indulgence. Seems ask meant merry could put. Age old begin had boy noisy table front whole given.", "Enjoying minutes related as at on on. Is dried as often me. Goodness as reserved raptures to mistaken steepest oh screened he. Gravity he mr sixteen esteems. Mile home its new way with high told said. Finished no horrible blessing landlord\n dwelling dissuade if. Rent fond am he in on read. Anxious cordial demands settled entered in do to colonel.", " <p>Remaining lively hardly needed at do by. Two you fat downs three.\n True mr gone most at. Dare as name just when with it body. Travelling inquietude she increasing off impossible the. Cottage be noisier looking to we promise on. Disposal to kindness appetite diverted learning of on raptures.<br> Betrayed any may returned now dashwood formerly. Balls way delay shy man views. No so instrument discretion unsatiable to in.</p>", ]; $pattern = '%^(\s+)|^(\w+)(ing)%'; var_dump(preg_grep($pattern, $arr2)); /* Invert results with Flag */ var_dump(preg_grep($pattern, $arr2, PREG_GREP_INVERT));

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.20.0030.00520.71
8.4.10.0060.00319.69
8.3.140.0080.00017.21
8.3.130.0080.00018.66
8.3.120.0060.00318.90
8.3.110.0030.00520.94
8.3.100.0080.00420.13
8.3.90.0040.00426.77
8.3.80.0090.00016.63
8.3.70.0150.00316.63
8.3.60.0090.00918.40
8.3.50.0100.00716.53
8.3.40.0040.01418.88
8.3.30.0100.01018.84
8.3.20.0040.00421.76
8.3.10.0080.00018.98
8.3.00.0080.00021.73
8.2.260.0100.01016.53
8.2.250.0040.00417.04
8.2.240.0090.00922.16
8.2.230.0080.00022.58
8.2.220.0040.00424.06
8.2.210.0060.01226.77
8.2.200.0060.00316.88
8.2.190.0070.01118.41
8.2.180.0040.01225.92
8.2.170.0120.00322.96
8.2.160.0060.00920.43
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0080.00019.82
8.2.110.0030.00719.33
8.2.100.0060.00617.91
8.2.90.0060.00317.84
8.2.80.0090.00017.97
8.2.70.0050.00317.91
8.2.60.0060.00318.03
8.2.50.0090.00018.10
8.2.40.0050.00319.20
8.2.30.0030.00619.14
8.2.20.0060.00318.03
8.2.10.0080.00018.88
8.2.00.0000.00719.31
8.1.310.0050.00318.59
8.1.300.0030.00617.96
8.1.290.0060.00318.88
8.1.280.0120.00625.92
8.1.270.0030.00622.19
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0000.01024.00
8.1.230.0070.00422.66
8.1.220.0030.00617.74
8.1.210.0000.00818.92
8.1.200.0050.00317.47
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0040.00418.66
8.1.160.0030.00518.87
8.1.150.0040.00418.86
8.1.140.0000.00718.84
8.1.130.0000.00720.10
8.1.120.0080.00017.57
8.1.110.0040.00417.45
8.1.100.0070.00017.44
8.1.90.0040.00717.59
8.1.80.0040.00417.43
8.1.70.0030.00317.58
8.1.60.0000.00817.71
8.1.50.0000.00717.64
8.1.40.0090.00017.65
8.1.30.0000.00817.64
8.1.20.0040.00417.73
8.1.10.0080.00017.56
8.1.00.0000.00817.51
8.0.300.0000.00819.98
8.0.290.0030.00516.75
8.0.280.0050.00318.46
8.0.270.0030.00316.78
8.0.260.0030.00318.46
8.0.250.0070.00017.03
8.0.240.0000.00716.95
8.0.230.0040.00416.91
8.0.220.0000.00717.02
8.0.210.0030.00316.98
8.0.200.0040.00717.02
8.0.190.0040.00416.93
8.0.180.0040.00417.00
8.0.170.0050.00516.88
8.0.160.0000.00717.02
8.0.150.0090.00016.88
8.0.140.0040.00416.94
8.0.130.0070.00013.42
8.0.120.0040.00416.96
8.0.110.0040.00416.96
8.0.100.0000.00716.94
8.0.90.0000.00717.00
8.0.80.0060.00916.88
8.0.70.0000.00816.93
8.0.60.0040.00416.95
8.0.50.0040.00416.78
8.0.30.0080.00817.04
8.0.20.0170.00316.85
8.0.10.0050.00317.15
8.0.00.0090.01216.86
7.4.330.0050.00015.55
7.4.320.0060.00016.75
7.4.300.0030.00316.58
7.4.290.0040.00416.70
7.4.280.0070.00016.78
7.4.270.0000.00716.66
7.4.260.0000.00716.78
7.4.250.0070.00016.73
7.4.240.0040.00416.68
7.4.230.0070.00016.66
7.4.220.0000.00816.76
7.4.210.0070.00916.83
7.4.200.0030.00416.84
7.4.160.0130.00616.63
7.4.130.0120.00816.68
7.4.120.0040.01316.46
7.4.110.0070.01016.59
7.4.100.0000.01616.68
7.4.90.0080.01116.57
7.4.80.0060.00919.39
7.4.70.0130.01016.58
7.4.60.0030.01816.73
7.4.50.0120.00016.29
7.4.40.0080.00816.56
7.4.00.0060.01115.05
7.3.330.0030.00313.21
7.3.320.0030.00313.04
7.3.310.0000.00716.18
7.3.300.0070.00016.23
7.3.290.0070.00016.23
7.3.280.0090.00616.29
7.3.260.0100.00816.42
7.3.240.0120.00716.38
7.3.230.0040.01316.37
7.3.210.0120.00616.71
7.3.200.0110.00616.33
7.3.190.0030.01316.30
7.3.180.0140.00316.67
7.3.170.0040.01316.39
7.3.160.0100.01316.51
7.3.120.0090.00714.81
7.3.110.0060.01214.86
7.3.100.0070.00914.79
7.3.90.0050.00614.91
7.3.80.0040.00714.87
7.3.70.0080.00714.75
7.3.60.0080.00614.88
7.3.50.0030.01314.86
7.3.40.0080.00514.72
7.3.30.0090.00714.77
7.3.20.0050.00916.22
7.3.10.0040.01116.31
7.3.00.0060.00816.25
7.2.330.0090.00916.47
7.2.320.0060.01216.70
7.2.310.0090.00916.67
7.2.300.0160.00316.41
7.2.290.0120.00616.46
7.2.250.0090.01014.96
7.2.240.0120.00715.10
7.2.230.0040.01115.04
7.2.220.0070.00714.90
7.2.210.0070.00715.06
7.2.200.0050.00815.02
7.2.190.0050.00815.16
7.2.180.0040.01215.06
7.2.170.0060.00915.01
7.2.160.0070.00714.95
7.2.150.0230.00315.13
7.2.140.0210.00514.80
7.2.130.0220.00614.96
7.2.120.0160.00015.00
7.2.110.0140.00314.88
7.2.100.0250.00814.80
7.2.90.0090.00914.87
7.2.80.0180.01014.98
7.2.70.0160.00415.13
7.2.60.0220.00915.27
7.2.50.0090.00915.02
7.2.40.0180.00914.98
7.2.30.0240.00315.11
7.2.20.0160.01614.91
7.2.10.0140.00315.13
7.2.00.0130.00314.84
7.1.330.0090.00515.61
7.1.320.0070.00615.84
7.1.310.0050.00915.85
7.1.300.0050.00715.85
7.1.290.0070.00815.96
7.1.280.0070.00515.46
7.1.270.0070.00715.46
7.1.260.0210.01015.32
7.1.250.0120.00313.90

preferences:
29.89 ms | 403 KiB | 5 Q