3v4l.org

run code in 300+ PHP versions simultaneously
<?php $superheroes = array( "spider-man" => array( "name" => "Peter Parker", "email" => "peterparker@mail.com", ), "super-man" => array( "name" => "Clark Kent", "email" => "clarkkent@mail.com", ), "iron-man" => array( "name" => "Harry Potter", "email" => "harrypotter@mail.com", ) ); function checkArray($array) { forEach($array as $index => $item) { if(is_Array ($item)) { echo "========== \n"; $dimensionPath = $array . $index; echo "YES-" . $dimensionPath . ": " . $item . "\n"; checkArray($item); } else { echo "NO-" . $index . ": " . $item . "\n"; } } } checkArray($superheroes);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
========== Warning: Array to string conversion in /in/AmisR on line 21 Warning: Array to string conversion in /in/AmisR on line 22 YES-Arrayspider-man: Array NO-name: Peter Parker NO-email: peterparker@mail.com ========== Warning: Array to string conversion in /in/AmisR on line 21 Warning: Array to string conversion in /in/AmisR on line 22 YES-Arraysuper-man: Array NO-name: Clark Kent NO-email: clarkkent@mail.com ========== Warning: Array to string conversion in /in/AmisR on line 21 Warning: Array to string conversion in /in/AmisR on line 22 YES-Arrayiron-man: Array NO-name: Harry Potter NO-email: harrypotter@mail.com
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
========== Notice: Array to string conversion in /in/AmisR on line 21 Notice: Array to string conversion in /in/AmisR on line 22 YES-Arrayspider-man: Array NO-name: Peter Parker NO-email: peterparker@mail.com ========== Notice: Array to string conversion in /in/AmisR on line 21 Notice: Array to string conversion in /in/AmisR on line 22 YES-Arraysuper-man: Array NO-name: Clark Kent NO-email: clarkkent@mail.com ========== Notice: Array to string conversion in /in/AmisR on line 21 Notice: Array to string conversion in /in/AmisR on line 22 YES-Arrayiron-man: Array NO-name: Harry Potter NO-email: harrypotter@mail.com
Output for 7.3.32 - 7.3.33
========== YES-Arrayspider-man: Array NO-name: Peter Parker NO-email: peterparker@mail.com ========== YES-Arraysuper-man: Array NO-name: Clark Kent NO-email: clarkkent@mail.com ========== YES-Arrayiron-man: Array NO-name: Harry Potter NO-email: harrypotter@mail.com

preferences:
224.01 ms | 402 KiB | 270 Q