3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Gist { public static function result( $url ) { $url = strtolower( $url[0] ); // Adjust the URL if it contains a specific file within the Gist. $fragment = strpos( $url, '#' ); if ( false !== $fragment ) { if ( str_contains( $url, '.js#' ) ) { $url = str_replace( '.js#file-', '.js?file=', $url ); } else { $url = str_replace( '#file-', '.js?file=', $url ); } $last_hyphen = strrpos( $url, '-' ); if ( false !== $last_hyphen && $last_hyphen > $fragment ) { $url[ $last_hyphen ] = '.'; } } elseif ( ! str_ends_with( $url, '.js' ) ) { $url .= '.js'; } // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript return '<script src="' . $url . '"></script>'; } } $urls = [ 'no extension' => [ 'url' => 'https://gist.github.com/costdev/796167d5f34ec55caf281e8f1fb82c8a#file-a_file', 'expected' => 'https://gist.github.com/costdev/796167d5f34ec55caf281e8f1fb82c8a.js#file-a_file', ], '.gitignore' => [ 'url' => 'https://gist.github.com/costdev/796167d5f34ec55caf281e8f1fb82c8a#file-gitignore', 'expected' => 'https://gist.github.com/costdev/796167d5f34ec55caf281e8f1fb82c8a.js#file-gitignore', ], ]; $failures = []; foreach ( $urls as $dataset => $data ) { $url = $data['url']; $expected = $data['expected']; $actual = Gist::result( [ $url ] ); if ( $actual === '<script src="' . $expected . '"></script>' ) { echo '.'; } else { echo 'F'; $failures[] = "Failure: $dataset\nExpected: $expected\nActual: $actual\n\n"; } } echo "\n\n", implode( "\n", $failures );

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.10.0070.01119.74
8.5.00.0130.00819.82
8.4.150.0020.00014.05
8.4.140.0120.01017.62
8.4.130.0120.00817.61
8.4.120.0120.00520.73
8.4.110.0100.01122.27
8.4.100.0180.00317.99
8.4.90.0060.00518.71
8.4.80.0100.01118.01
8.4.70.0090.00817.80
8.4.60.0140.00620.63
8.4.50.0120.00619.39
8.4.40.0040.00420.38
8.4.30.0130.00619.08
8.4.20.0100.01020.67
8.4.10.0000.00823.93
8.3.280.0130.00718.44
8.3.270.0150.00416.74
8.3.260.0050.00416.74
8.3.250.0120.00818.86
8.3.240.0020.00616.67
8.3.230.0100.00916.37
8.3.220.0050.00317.26
8.3.210.0070.01118.58
8.3.200.0050.00416.76
8.3.190.0040.00517.16
8.3.180.0120.00716.59
8.3.170.0030.01418.91
8.3.160.0060.01218.38
8.3.150.0150.00320.92
8.3.140.0030.00616.79
8.3.130.0040.00718.43
8.3.120.0030.00618.91
8.3.110.0100.00720.94
8.3.100.0040.00424.06
8.3.90.0030.00526.77
8.3.80.0060.00317.97
8.3.70.0070.00718.28
8.3.60.0080.00818.55
8.3.50.0080.00816.69
8.3.40.0150.00619.92
8.3.30.0110.00718.83
8.3.20.0060.00324.18
8.3.10.0030.00624.66
8.3.00.0040.00426.16
8.2.290.0060.00220.46
8.2.280.0120.00718.24
8.2.270.0000.02017.18
8.2.260.0080.00018.73
8.2.250.0040.00416.83
8.2.240.0030.00617.10
8.2.230.0000.01122.58
8.2.220.0040.00437.54
8.2.210.0040.00426.77
8.2.200.0070.00316.50
8.2.190.0070.01116.63
8.2.180.0140.00716.50
8.2.170.0070.00718.93
8.2.160.0140.00022.96
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00421.13
8.2.110.0060.00622.31
8.2.100.0040.00817.78
8.2.90.0040.00417.75
8.2.80.0080.00018.78
8.2.70.0000.00817.75
8.2.60.0040.00417.50
8.2.50.0150.00219.52
8.2.40.0140.00319.52
8.2.30.0170.00019.52
8.2.20.0130.00319.52
8.2.10.0120.00619.52
8.2.00.0140.00219.52
8.1.330.0120.00721.79
8.1.320.0050.00415.78
8.1.310.0080.00016.90
8.1.300.0060.01220.37
8.1.290.0060.00318.88
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00023.88
8.1.230.0060.00619.21
8.1.220.0000.00717.74
8.1.210.0000.00918.77
8.1.200.0030.00617.36
8.1.190.0040.00417.39
8.1.180.0110.00519.52
8.1.170.0090.00919.52
8.1.160.0150.00319.52
8.1.150.0110.00619.52
8.1.140.0070.00519.52
8.1.130.0170.00019.52
8.1.120.0170.00219.52
8.1.110.0080.00819.52
8.1.100.0140.00419.52
8.1.90.0110.00419.52
8.1.80.0100.00619.52
8.1.70.0080.00819.52
8.1.60.0170.00019.52
8.1.50.0090.00919.52
8.1.40.0120.00619.52
8.1.30.0060.01219.52
8.1.20.0130.00419.52
8.1.10.0130.00419.52
8.1.00.0110.00619.52
8.0.300.0040.00418.77
8.0.290.0040.00416.61
8.0.280.0130.00319.52
8.0.270.0140.00519.52
8.0.260.0170.00019.52
8.0.250.0140.00619.52
8.0.240.0140.00319.52
8.0.230.0140.00219.52
8.0.220.0060.01119.52
8.0.210.0110.00519.52
8.0.200.0110.00519.52
8.0.190.0110.00519.52
8.0.180.0060.01019.52
8.0.170.0170.00019.52
8.0.160.0170.00019.52
8.0.150.0130.00319.52
8.0.140.0080.00819.52
8.0.130.0190.00019.52
8.0.120.0140.00319.52
8.0.110.0150.00019.52
8.0.100.0130.00319.52
8.0.90.0100.00619.52
8.0.80.0170.00019.52
8.0.70.0160.00019.52
8.0.60.0100.00719.52
8.0.50.0080.00819.52
8.0.30.0130.00319.52
8.0.20.0170.00019.52
8.0.10.0120.00419.52

preferences:
121.93 ms | 403 KiB | 5 Q