3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 6; var_dump($a['foo']); var_dump($a['foo'] !== null); echo "\n---\n"; $a = []; var_dump($a['foo']); var_dump($a['foo'] !== null);
Output for 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Warning: Trying to access array offset on int in /in/fsbh2 on line 4 NULL Warning: Trying to access array offset on int in /in/fsbh2 on line 5 bool(false) --- Warning: Undefined array key "foo" in /in/fsbh2 on line 10 NULL Warning: Undefined array key "foo" in /in/fsbh2 on line 11 bool(false)
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27
Warning: Trying to access array offset on value of type int in /in/fsbh2 on line 4 NULL Warning: Trying to access array offset on value of type int in /in/fsbh2 on line 5 bool(false) --- Warning: Undefined array key "foo" in /in/fsbh2 on line 10 NULL Warning: Undefined array key "foo" in /in/fsbh2 on line 11 bool(false)
Output for 7.4.0 - 7.4.33
Notice: Trying to access array offset on value of type int in /in/fsbh2 on line 4 NULL Notice: Trying to access array offset on value of type int in /in/fsbh2 on line 5 bool(false) --- Notice: Undefined index: foo in /in/fsbh2 on line 10 NULL Notice: Undefined index: foo in /in/fsbh2 on line 11 bool(false)
Output for 7.3.32 - 7.3.33
NULL bool(false) --- NULL bool(false)
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
NULL bool(false) --- Notice: Undefined index: foo in /in/fsbh2 on line 10 NULL Notice: Undefined index: foo in /in/fsbh2 on line 11 bool(false)

preferences:
136.8 ms | 412 KiB | 5 Q