3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_contains_eval( $show = '' ) { $url = true; if ( ! str_contains( $show, 'url' ) && ! str_contains( $show, 'directory' ) && ! str_contains( $show, 'home' ) ) { $url = false; } if ( $url ) {} } function preg_match_eval( $show = '' ) { if ( preg_match( '/url|directory|home/', $show ) ) {} } $its = 1e3; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = str_contains_eval( 'blogname' ); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = preg_match_eval( 'blogname' ); echo (hrtime(true)-$t)/1e9,"s\n"; echo "\n=== Warmed up ===\n\n"; $its = 1e5; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = str_contains_eval( 'blogname' ); echo 'str_contains chain: ', $a=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = preg_match_eval( 'blogname' ); echo 'preg_match : ', $b=(hrtime(true)-$t)/1e9,"s\n"; echo 'preg_match is ', number_format((($a-$b)/$a) * 100, 2 ), "% faster than str_contains chain\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.5.30.0120.03619.54
8.5.20.0140.03718.58
8.5.10.0140.03816.79
8.5.00.0150.03020.32
8.4.180.0140.04221.71
8.4.170.0150.03320.43
8.4.160.0090.03823.89
8.4.150.0030.00014.05
8.4.140.0110.03518.00
8.4.130.0110.02617.85
8.4.120.0100.01920.59
8.4.110.0100.01922.39
8.4.100.0090.01818.04
8.4.90.0130.02718.91
8.4.80.0060.01222.63
8.4.70.0100.03318.04
8.4.60.0130.03218.93
8.4.50.0110.02818.64
8.4.40.0030.03617.96
8.4.30.0060.01218.65
8.4.20.0130.03018.09
8.4.10.0070.02919.66
8.3.300.0140.03620.63
8.3.290.0140.04020.82
8.3.280.0140.03818.66
8.3.270.0090.04316.63
8.3.260.0140.01816.61
8.3.250.0130.02718.93
8.3.240.0130.02716.79
8.3.230.0130.02216.71
8.3.220.0040.01317.21
8.3.210.0090.01916.75
8.3.200.0050.01916.77
8.3.190.0110.02219.06
8.3.180.0080.01816.78
8.3.170.0060.02220.86
8.3.160.0130.03318.54
8.3.150.0060.03220.83
8.3.140.0130.03016.68
8.3.130.0090.01218.62
8.3.120.0040.01820.88
8.3.110.0030.01720.94
8.3.100.0060.01524.06
8.3.90.0070.01326.77
8.3.80.0100.02318.43
8.3.70.0100.04018.66
8.3.60.0000.03816.63
8.3.50.0040.03516.96
8.3.40.0100.02723.70
8.3.30.0070.03019.04
8.3.20.0070.01324.18
8.3.10.0070.01324.66
8.3.00.0030.01626.16
8.2.300.0130.03822.28
8.2.290.0060.02320.64
8.2.280.0130.03518.47
8.2.270.0070.04117.05
8.2.260.0070.02018.82
8.2.250.0070.01318.47
8.2.240.0130.03819.06
8.2.230.0000.02222.58
8.2.220.0070.01437.54
8.2.210.0040.01826.77
8.2.200.0070.01818.41
8.2.190.0170.03716.75
8.2.180.0140.04416.50
8.2.170.0100.02619.04
8.2.160.0160.02222.96
8.2.150.0000.01925.66
8.2.140.0070.01424.66
8.2.130.0060.01326.16
8.2.120.0070.01321.37
8.2.110.0100.01922.20
8.2.100.0280.02418.44
8.2.90.0230.02318.44
8.2.80.0260.02318.44
8.2.70.0280.02118.44
8.2.60.0080.04218.44
8.2.50.0250.02718.44
8.2.40.0180.02818.44
8.2.30.0220.02218.44
8.2.20.0190.02618.44
8.2.10.0240.02118.44
8.2.00.0290.01618.44
8.1.340.0110.03921.67
8.1.330.0080.02720.41
8.1.320.0090.03915.98
8.1.310.0060.01518.51
8.1.300.0090.01318.63
8.1.290.0090.01618.88
8.1.280.0100.03325.92
8.1.270.0060.01424.66
8.1.260.0030.01626.35
8.1.250.0030.01728.09
8.1.240.0040.02524.08
8.1.230.0310.01418.44
8.1.220.0180.02618.44
8.1.210.0280.01718.44
8.1.200.0270.01718.44
8.1.190.0240.01818.44
8.1.180.0260.01918.44
8.1.170.0140.02818.44
8.1.160.0180.02518.44
8.1.150.0180.02618.44
8.1.140.0200.03118.44
8.1.130.0150.03018.44
8.1.120.0170.02718.44
8.1.110.0130.03018.44
8.1.100.0170.02618.44
8.1.90.0210.02418.44
8.1.80.0340.02318.44
8.1.70.0240.02118.44
8.1.60.0160.02818.44
8.1.50.0210.02118.44
8.1.40.0220.02218.44
8.1.30.0290.01618.44
8.1.20.0270.02418.44
8.1.10.0260.01918.44
8.1.00.0140.02718.44
8.0.300.0140.02618.44
8.0.290.0230.02318.44
8.0.280.0210.02518.44
8.0.270.0230.02418.44
8.0.260.0210.02418.44
8.0.250.0260.01918.44
8.0.240.0290.01618.44
8.0.230.0240.02118.44
8.0.220.0160.02618.44
8.0.210.0280.01718.44
8.0.200.0260.02018.44
8.0.190.0220.02218.44
8.0.180.0210.02418.44
8.0.170.0160.02818.44
8.0.160.0190.02418.44
8.0.150.0200.02018.44
8.0.140.0280.01718.44
8.0.130.0130.02618.44
8.0.120.0260.02318.44
8.0.110.0210.02518.44
8.0.100.0210.02518.44
8.0.90.0140.03118.44
8.0.80.0210.02118.44
8.0.70.0180.02918.44
8.0.60.0180.02518.44
8.0.50.0230.02018.44
8.0.30.0140.02918.44
8.0.20.0160.02718.44
8.0.10.0230.02318.44

preferences:
36.48 ms | 475 KiB | 5 Q