3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dogs= [ ['name'=>'jippy','age'=>12 ,'address'=>'bhaktapur', 'size'=>[ 'weight'=>52, 'heght' =>2]], ['name'=>'jipu','age'=>2 ,'address'=>'pur', 'size'=>[ 'weight'=>52, 'heght' =>2]] ]; foreach($dogs as $key=> $item){ foreach($item as $innerkey=>$inneritem) { echo $innerkey . ' ' . $inneritem[$innerkey. "\n"]; } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/uRX1G:10 Stack trace: #0 {main} thrown in /in/uRX1G on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Illegal string offset 'name ' in /in/uRX1G on line 10 name j Notice: Trying to access array offset on value of type int in /in/uRX1G on line 10 age Warning: Illegal string offset 'address ' in /in/uRX1G on line 10 address b Notice: Undefined index: size in /in/uRX1G on line 10 size Warning: Illegal string offset 'name ' in /in/uRX1G on line 10 name j Notice: Trying to access array offset on value of type int in /in/uRX1G on line 10 age Warning: Illegal string offset 'address ' in /in/uRX1G on line 10 address p Notice: Undefined index: size in /in/uRX1G on line 10 size
Output for 7.3.32 - 7.3.33
Warning: Illegal string offset 'name ' in /in/uRX1G on line 10 name jage Warning: Illegal string offset 'address ' in /in/uRX1G on line 10 address bsize Warning: Illegal string offset 'name ' in /in/uRX1G on line 10 name jage Warning: Illegal string offset 'address ' in /in/uRX1G on line 10 address psize
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Warning: Illegal string offset 'name ' in /in/uRX1G on line 10 name jage Warning: Illegal string offset 'address ' in /in/uRX1G on line 10 address b Notice: Undefined index: size in /in/uRX1G on line 10 size Warning: Illegal string offset 'name ' in /in/uRX1G on line 10 name jage Warning: Illegal string offset 'address ' in /in/uRX1G on line 10 address p Notice: Undefined index: size in /in/uRX1G on line 10 size

preferences:
168.85 ms | 403 KiB | 212 Q