3v4l.org

run code in 300+ PHP versions simultaneously
<?php for( $errors_count = 1; $errors_count < 5; $errors_count++ ) { echo 'Current code:'.PHP_EOL; var_dump( 'unknown_upgrade_error_' . $errors_count + 1 ); echo PHP_EOL.'Fixed code:'.PHP_EOL; var_dump( 'unknown_upgrade_error_' . ( $errors_count + 1 ) ); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.24, 8.2.0 - 8.2.11
Current code: string(23) "unknown_upgrade_error_2" Fixed code: string(23) "unknown_upgrade_error_2" Current code: string(23) "unknown_upgrade_error_3" Fixed code: string(23) "unknown_upgrade_error_3" Current code: string(23) "unknown_upgrade_error_4" Fixed code: string(23) "unknown_upgrade_error_4" Current code: string(23) "unknown_upgrade_error_5" Fixed code: string(23) "unknown_upgrade_error_5"
Output for 7.4.0 - 7.4.33
Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /in/EYuU8 on line 5 Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_2" Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_3" Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_4" Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_5"
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33
Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_2" Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_3" Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_4" Current code: Warning: A non-numeric value encountered in /in/EYuU8 on line 5 int(1) Fixed code: string(23) "unknown_upgrade_error_5"

preferences:
63.03 ms | 410 KiB | 5 Q