3v4l.org

run code in 300+ PHP versions simultaneously
<?php global $wp_version; $wp_version = '6.9-beta2-61080-src'; function is_wp_version_compatible( $required ) { global $wp_version; // Strip off any -alpha, -RC, -beta, -src suffixes. list( $version ) = explode( '-', $wp_version ); if ( is_string( $required ) ) { $trimmed = trim( $required ); if ( substr_count( $trimmed, '.' ) > 1 && str_ends_with( $trimmed, '.0' ) ) { $required = substr( $trimmed, 0, -2 ); } } return empty( $required ) || version_compare( $version, $required, '>=' ); } $tests = [ '6.9', '6.9.2', '6.8.3, '6.8.4-beta', '5.4' ]; print_r( array_combine( $tests ), array_map( 'is_wp_version_compatible', $tests ) );
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Parse error: syntax error, unexpected floating-point number "6.8", expecting "]" in /in/l9pVB on line 24
Process exited with code 255.

preferences:
147.96 ms | 1398 KiB | 6 Q