3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dictionary = array("hello", "hi", "how r u", "how are you", "how r you", "how are u"); function isDictionaryWord($str,$dictionary){ foreach($dictionary as $each_word){ if(isSubsequence(strtolower($each_word),strtolower($str))){ return true; } } return false; } function isSubsequence($needle,$haystack){ $len1 = strlen($needle); $len2 = strlen($haystack); if($len1 > $len2) return false; $ptr = 0; for($i=0;$i<$len2 && $ptr < $len1;$i++){ if($haystack[$i] === $needle[$ptr]) $ptr++; } return $ptr == $len1; } $tests = array( 'Hello', 'Helloooo', 'How r youuu !!!!', 'hell', 'w are y' ); foreach($tests as $each_test){ echo $each_test," => ",var_dump(isDictionaryWord($each_test,$dictionary)),PHP_EOL; }

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.120.0110.00924.09
8.4.110.0060.00222.39
8.4.100.0020.00718.63
8.4.90.0130.00718.64
8.4.80.0130.00718.86
8.4.70.0100.00918.13
8.4.60.0130.00818.52
8.4.50.0060.00317.70
8.4.40.0060.01319.66
8.4.30.0090.00019.43
8.4.20.0100.00020.43
8.4.10.0140.00717.74
8.3.250.0120.00418.91
8.3.240.0110.00817.30
8.3.230.0050.00516.53
8.3.220.0100.00619.10
8.3.210.0120.00716.41
8.3.200.0050.00316.59
8.3.190.0130.00517.37
8.3.180.0090.01116.53
8.3.170.0130.00616.45
8.3.160.0190.00016.73
8.3.150.0040.01517.14
8.3.140.0040.00416.48
8.3.130.0080.00018.46
8.3.120.0040.00420.91
8.3.110.0080.00016.49
8.3.100.0040.00416.50
8.3.90.0040.00426.77
8.3.80.0090.00016.50
8.3.70.0070.00716.58
8.3.60.0130.00318.30
8.3.50.0190.00818.07
8.3.40.0110.00418.61
8.3.30.0090.00618.70
8.3.20.0060.00321.71
8.3.10.0060.00323.54
8.3.00.0040.00423.52
8.2.290.0140.00520.21
8.2.280.0080.00218.37
8.2.270.0150.00416.87
8.2.260.0120.00620.86
8.2.250.0050.00316.54
8.2.240.0000.00917.42
8.2.230.0000.00920.94
8.2.220.0050.00337.54
8.2.210.0050.00326.77
8.2.200.0100.00016.63
8.2.190.0180.00316.88
8.2.180.0090.00916.88
8.2.170.0100.01022.96
8.2.160.0100.00720.52
8.2.150.0040.00424.18
8.2.140.0040.00724.66
8.2.130.0040.00417.84
8.2.120.0040.00426.35
8.2.110.0130.01020.55
8.2.100.0040.00817.91
8.2.90.0000.00817.97
8.2.80.0040.00417.97
8.2.70.0030.00517.93
8.2.60.0080.00018.28
8.2.50.0040.00818.10
8.2.40.0000.00819.53
8.2.30.0000.00919.23
8.2.20.0050.00318.02
8.2.10.0000.00819.38
8.2.00.0000.01019.46
8.1.330.0120.00822.19
8.1.320.0140.00716.12
8.1.310.0070.01118.69
8.1.300.0090.00618.63
8.1.290.0030.00730.84
8.1.280.0100.01025.92
8.1.270.0080.00019.00
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0060.00322.45
8.1.230.0030.00722.72
8.1.220.0080.00017.77
8.1.210.0050.00518.77
8.1.200.0040.00417.23
8.1.190.0050.00317.35
8.1.180.0030.00618.10
8.1.170.0080.00018.55
8.1.160.0000.00718.93
8.1.150.0030.00518.86
8.1.140.0080.00022.16
8.1.130.0070.00017.46
8.1.120.0000.00717.48
8.1.110.0060.00317.46
8.1.100.0040.00417.35
8.1.90.0000.00817.46
8.1.80.0000.00817.38
8.1.70.0000.00717.45
8.1.60.0030.00917.60
8.1.50.0090.00017.47
8.1.40.0000.00817.58
8.1.30.0090.00017.61
8.1.20.0040.00417.55
8.1.10.0050.00317.61
8.1.00.0080.00017.52
8.0.300.0090.00020.03
8.0.290.0060.00316.63
8.0.280.0000.00718.42
8.0.270.0000.00717.27
8.0.260.0000.00716.78
8.0.250.0040.00416.89
8.0.240.0040.00416.96
8.0.230.0080.00016.84
8.0.220.0100.00016.89
8.0.210.0000.00716.79
8.0.200.0070.00016.97
8.0.190.0030.00516.80
8.0.180.0030.00616.92
8.0.170.0060.00316.92
8.0.160.0020.00516.95
8.0.150.0000.00716.80
8.0.140.0040.00416.74
8.0.130.0040.00413.29
8.0.120.0080.00016.91
8.0.110.0070.00016.95
8.0.100.0000.00716.77
8.0.90.0040.00416.85
8.0.80.0080.00816.91
8.0.70.0000.00717.00
8.0.60.0080.00016.95
8.0.50.0070.00016.79
8.0.30.0130.00416.98
8.0.20.0100.00817.40
8.0.10.0050.00317.07
8.0.00.0100.00816.81
7.4.330.0060.00016.83
7.4.320.0070.00016.52
7.4.300.0070.00016.66
7.4.290.0050.00216.53
7.4.280.0040.00416.63
7.4.270.0070.00516.59
7.4.260.0030.00516.63
7.4.250.0000.00716.39
7.4.240.0050.00316.42
7.4.230.0070.00016.69
7.4.220.0000.00816.73
7.4.210.0060.00916.61
7.4.200.0050.00216.37
7.4.160.0100.00616.65
7.4.140.0120.00617.86
7.4.130.0060.01216.52
7.4.120.0120.00616.43
7.4.110.0030.01516.64
7.4.100.0100.01316.42
7.4.90.0130.00516.56
7.4.80.0160.00819.39
7.4.70.0130.00316.57
7.4.60.0030.01316.45
7.4.50.0050.00716.22
7.4.40.0060.00916.46
7.4.00.0070.00715.24
7.3.330.0000.00513.41
7.3.320.0060.00013.41
7.3.310.0080.00016.42
7.3.300.0020.00516.26
7.3.290.0070.00016.48
7.3.280.0060.01216.36
7.3.260.0090.01216.55
7.3.240.0130.00616.60
7.3.230.0100.00716.31
7.3.210.0070.01016.49
7.3.200.0130.00316.39
7.3.190.0160.00716.43
7.3.180.0130.00516.47
7.3.170.0170.00016.27
7.3.160.0130.00316.32
7.3.00.0290.00314.69
7.2.330.0110.00716.69
7.2.320.0100.00716.78
7.2.310.0180.00416.78
7.2.300.0070.01016.63
7.2.290.0140.00916.83
7.2.130.0420.00714.99
7.2.120.0150.00615.02
7.2.110.0070.01114.86
7.2.100.0120.00414.76
7.2.90.0750.00314.91
7.2.80.0190.01515.19
7.2.70.0240.01014.96
7.2.60.0250.00714.68
7.2.50.0130.00815.03
7.2.40.0230.00714.85
7.2.30.0120.00614.79
7.2.20.0250.00415.02
7.2.10.0250.00814.79
7.2.00.0120.00415.01
7.1.250.0230.01113.70
7.0.330.0090.00913.48
5.6.380.0040.00814.50

preferences:
36.9 ms | 403 KiB | 5 Q