3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str='my fictional favourite food is Jellof Rice with salted water but not too much sugar and some rice'; #$str='banana apple mango'; $words=array( 'food', 'water', 'salt' ); function findmatches( $str=false, $search=array()){ if( !empty( $str ) && !empty( $search ) ){ array_walk( $search, function( &$item ){ $item=preg_quote( $item, '@' ); }); $pttn=sprintf('@(\w%s)@',implode( '|', $search ) ); preg_match_all( $pttn, $str, $matches, PREG_OFFSET_CAPTURE ); return !empty( array_filter( $matches ) ) ? $matches[0] : false; } return false; } function showresults( $arr ){ if( !empty( $arr ) ){ foreach( $arr as $i => $v ){ printf('The word "%s" was found at position %s',$v[0],$v[1]); } } } $res=findmatches( $str, $words ); echo $res ? showresults($res) : 'Not found'; ?>

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.01320.30
8.4.150.0030.00014.05
8.4.140.0160.00817.86
8.4.130.0140.00719.87
8.4.120.0070.00420.57
8.4.110.0110.00919.16
8.4.100.0120.00918.71
8.4.90.0060.01320.71
8.4.80.0110.00820.46
8.4.70.0060.00218.04
8.4.60.0110.00117.88
8.4.50.0130.00720.37
8.4.40.0130.00619.63
8.4.30.0100.01022.39
8.4.20.0100.01017.82
8.4.10.0130.00719.68
8.3.280.0130.00818.62
8.3.270.0120.00816.56
8.3.260.0130.00616.69
8.3.250.0090.01018.80
8.3.240.0120.00716.71
8.3.230.0040.00416.65
8.3.220.0100.00818.93
8.3.210.0100.01116.82
8.3.200.0070.00516.69
8.3.190.0090.00717.02
8.3.180.0100.00518.87
8.3.170.0150.00317.04
8.3.160.0140.00420.94
8.3.150.0150.00317.11
8.3.140.0160.00319.19
8.3.130.0150.00318.46
8.3.120.0090.00020.62
8.3.110.0000.00716.66
8.3.100.0050.00317.01
8.3.90.0080.00016.75
8.3.80.0090.00019.36
8.3.70.0070.00718.30
8.3.60.0180.00018.56
8.3.50.0120.00723.54
8.3.40.0140.00019.09
8.3.30.0040.01118.96
8.3.20.0030.00624.18
8.3.10.0040.00424.66
8.3.00.0050.00326.16
8.2.290.0120.00720.65
8.2.280.0080.01116.88
8.2.270.0150.00420.73
8.2.260.0090.00916.73
8.2.250.0050.00316.80
8.2.240.0120.00417.26
8.2.230.0030.00620.94
8.2.220.0050.00537.54
8.2.210.0030.00626.77
8.2.200.0060.00318.88
8.2.190.0090.01216.72
8.2.180.0160.00325.92
8.2.170.0060.00919.02
8.2.160.0090.00922.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0000.00726.16
8.2.120.0090.00026.35
8.2.110.0070.00320.57
8.2.100.0060.00917.72
8.2.90.0050.00318.34
8.2.80.0000.00818.03
8.2.70.0040.00417.93
8.2.60.0060.00318.16
8.2.50.0060.00318.22
8.2.40.0000.00818.28
8.2.30.0000.00718.07
8.2.20.0040.00418.29
8.2.10.0040.00419.31
8.2.00.0080.00019.47
8.1.330.0090.01116.39
8.1.320.0130.00716.61
8.1.310.0030.01316.90
8.1.300.0030.00716.48
8.1.290.0110.00030.84
8.1.280.0110.00425.92
8.1.270.0000.00823.99
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0060.00321.09
8.1.230.0080.00420.96
8.1.220.0030.00517.88
8.1.210.0000.00818.77
8.1.200.0030.00617.60
8.1.190.0000.00817.48
8.1.180.0050.00318.10
8.1.170.0000.00818.84
8.1.160.0060.00319.00
8.1.150.0000.00818.89
8.1.140.0040.00418.95
8.1.130.0100.00020.20
8.1.120.0040.00417.67
8.1.110.0080.00017.52
8.1.100.0070.00017.56
8.1.90.0040.00417.53
8.1.80.0090.00317.57
8.1.70.0040.00417.63
8.1.60.0050.00317.80
8.1.50.0060.00317.70
8.1.40.0050.00317.61
8.1.30.0000.00817.79
8.1.20.0000.00817.75
8.1.10.0040.00717.63
8.1.00.0000.00917.70
8.0.300.0040.00419.86
8.0.290.0060.00316.75
8.0.280.0000.00718.38
8.0.270.0000.00818.03
8.0.260.0000.00718.59
8.0.250.0000.00717.18
8.0.240.0060.00017.18
8.0.230.0070.00017.10
8.0.220.0000.00816.95
8.0.210.0000.00717.09
8.0.200.0040.00417.02
8.0.190.0050.00517.16
8.0.180.0050.00317.12
8.0.170.0040.00817.06
8.0.160.0000.00717.08
8.0.150.0040.00416.94
8.0.140.0040.00417.05
8.0.130.0050.00013.52
8.0.120.0050.00317.05
8.0.110.0040.00416.96
8.0.100.0040.00417.17
8.0.90.0070.00016.94
8.0.80.0050.01117.00
8.0.70.0000.00817.11
8.0.60.0080.00016.96
8.0.50.0040.00416.92
8.0.30.0030.01417.05
8.0.20.0150.00417.40
8.0.10.0050.00217.09
8.0.00.0140.00517.10
7.4.330.0000.00515.55
7.4.320.0030.00316.85
7.4.300.0040.00416.84
7.4.290.0040.00416.71
7.4.280.0080.00016.82
7.4.270.0070.00016.76
7.4.260.0000.00513.52
7.4.250.0030.00316.80
7.4.240.0000.00716.85
7.4.230.0080.00016.83
7.4.220.0050.00216.82
7.4.210.0100.00516.88
7.4.200.0070.00016.86
7.4.130.0100.00716.69
7.4.120.0090.01016.63
7.4.110.0120.01416.61
7.4.100.0130.00716.54
7.4.90.0050.01316.60
7.4.80.0120.00816.77
7.4.70.0030.01616.72
7.4.60.0130.00516.78
7.4.50.0060.01616.73
7.4.40.0080.01116.72
7.4.30.0120.00516.63
7.4.20.0100.00716.75
7.4.10.0090.00916.73
7.4.00.0150.00616.64
7.3.330.0070.00016.61
7.3.320.0060.00013.54
7.3.310.0000.00816.66
7.3.300.0030.00316.57
7.3.290.0070.00716.45
7.3.260.0090.00916.54
7.3.250.0050.01216.63
7.3.240.0070.01416.76
7.3.230.0110.01016.51
7.3.220.0100.00816.72
7.3.210.0070.01116.64
7.3.200.0100.01216.49
7.3.190.0080.01016.57
7.3.180.0090.00916.78
7.3.170.0160.00316.69
7.3.160.0090.00816.53
7.3.150.0110.00816.67
7.3.140.0170.00316.78
7.3.130.0080.00816.77
7.3.120.0130.00816.80
7.3.110.0100.01016.42
7.3.100.0090.00916.61
7.3.90.0100.01016.60
7.3.80.0080.01216.52
7.3.70.0090.01216.59
7.3.60.0090.00816.66
7.3.50.0100.01116.62
7.3.40.0050.01316.63
7.3.30.0070.01016.66
7.3.20.0120.00716.63
7.3.10.0080.01116.65
7.3.00.0130.00616.64

preferences:
46.03 ms | 403 KiB | 5 Q