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.4.20.0130.03018.09
8.4.10.0070.02919.66
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.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.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:
57.37 ms | 403 KiB | 5 Q