3v4l.org

run code in 300+ PHP versions simultaneously
<?php //https://www.php.net/manual/en/language.types.type-juggling.php $i = 0; switch($i) { case 'test': echo "1: $i\n"; break 1; } switch((string) $i) { case 'test': echo "2: $i\n"; break 1; } //weird :/ echo '3: ' . ($i == 'test' ? 'true': 'false') . "\n";
Output for 8.0.0 - 8.0.13, 8.1rc1 - rc3
3: false
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.26
1: 0 3: true

preferences:
28.36 ms | 460 KiB | 5 Q