3v4l.org

run code in 300+ PHP versions simultaneously
<?php // PHPで扱えるINTの最大値をあらかじめキーとしておきます $a = [PHP_INT_MAX => 'ABC']; $a[] = 1; // Fatal error: Uncaught Error: Cannot add element to the array as the next element is already occupied // 追加できずに停止します
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Fatal error: Uncaught Error: Cannot add element to the array as the next element is already occupied in /in/4899u:5 Stack trace: #0 {main} thrown in /in/4899u on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Cannot add element to the array as the next element is already occupied in /in/4899u on line 5

preferences:
65.92 ms | 407 KiB | 5 Q