3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_contains_eval( $show = '' ) { if ( str_contains( $show, 'url' ) || str_contains( $show, 'directory' ) || str_contains( $show, 'home' ) ) {} } 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.03017.95
8.4.10.0040.01419.58
8.3.150.0100.02616.88
8.3.140.0070.02417.22
8.3.130.0100.03418.38
8.3.120.0030.01720.73
8.3.110.0070.02420.94
8.3.100.0060.01216.75
8.3.90.0030.01626.77
8.3.80.0030.02018.43
8.3.70.0100.02618.43
8.3.60.0100.02618.30
8.3.50.0070.03816.78
8.3.40.0060.02823.79
8.3.30.0100.03419.27
8.3.20.0000.01924.18
8.3.10.0040.01524.66
8.3.00.0060.01226.16
8.2.270.0130.02217.15
8.2.260.0030.04116.96
8.2.250.0070.01316.54
8.2.240.0130.02219.07
8.2.230.0060.01322.58
8.2.220.0100.02837.54
8.2.210.0100.03526.77
8.2.200.0070.02016.62
8.2.190.0140.03116.63
8.2.180.0100.03216.88
8.2.170.0040.03219.22
8.2.160.0100.02922.96
8.2.150.0000.01825.66
8.2.140.0060.01224.66
8.2.130.0040.01526.16
8.2.120.0040.01521.00
8.2.110.0030.02322.38
8.2.100.0110.01818.44
8.2.90.0290.01618.44
8.2.80.0220.02218.44
8.2.70.0160.02718.44
8.2.60.0300.01718.44
8.2.50.0240.02418.44
8.2.40.0270.02118.44
8.2.30.0210.02118.44
8.2.20.0220.02218.44
8.2.10.0190.02318.44
8.2.00.0220.01918.44
8.1.310.0090.02518.59
8.1.300.0030.04018.27
8.1.290.0030.03018.88
8.1.280.0090.03425.92
8.1.270.0070.01324.09
8.1.260.0040.01526.35
8.1.250.0060.01228.09
8.1.240.0070.02023.95
8.1.230.0270.02118.44
8.1.220.0230.01918.44
8.1.210.0240.02118.44
8.1.200.0180.02418.44
8.1.190.0220.02218.44
8.1.180.0210.02118.44
8.1.170.0170.02418.44
8.1.160.0200.02018.44
8.1.150.0240.01818.44
8.1.140.0210.02118.44
8.1.130.0290.01618.44
8.1.120.0200.02318.44
8.1.110.0160.02618.44
8.1.100.0150.02618.44
8.1.90.0120.03318.44
8.1.80.0260.01818.44
8.1.70.0220.01918.44
8.1.60.0210.02118.44
8.1.50.0160.02518.44
8.1.40.0230.02018.44
8.1.30.0200.02318.44
8.1.20.0160.02818.44
8.1.10.0230.02118.44
8.1.00.0170.02318.44
8.0.300.0170.02018.57
8.0.290.0240.02018.44
8.0.280.0240.01718.44
8.0.270.0170.02618.44
8.0.260.0250.02018.44
8.0.250.0280.01518.44
8.0.240.0320.01418.44
8.0.230.0190.02318.44
8.0.220.0260.01818.44
8.0.210.0200.02318.44
8.0.200.0310.01818.44
8.0.190.0260.01918.44
8.0.180.0180.02718.44
8.0.170.0260.01618.44
8.0.160.0280.01518.44
8.0.150.0200.01618.48
8.0.140.0150.02718.44
8.0.130.0190.01918.55
8.0.120.0210.02118.44
8.0.110.0220.02218.44
8.0.100.0260.01818.44
8.0.90.0220.02218.44
8.0.80.0170.02418.44
8.0.70.0260.01818.44
8.0.60.0220.01918.44
8.0.50.0210.02118.44
8.0.30.0230.01918.44
8.0.20.0200.02018.44
8.0.10.0190.02418.44

preferences:
29.78 ms | 403 KiB | 5 Q