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", ) ); //print_r($superheroes); function checkArray($array) { forEach($array as $index => $item) { if(is_Array($item)) { echo "YES-" . ": " . $item . "\n"; checkArray($item); } else { echo "NO-" . ": " . $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/teaai on line 22 YES-: Array NO-: Peter Parker NO-: peterparker@mail.com Warning: Array to string conversion in /in/teaai on line 22 YES-: Array NO-: Clark Kent NO-: clarkkent@mail.com Warning: Array to string conversion in /in/teaai on line 22 YES-: Array NO-: Harry Potter NO-: harrypotter@mail.com
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Notice: Array to string conversion in /in/teaai on line 22 YES-: Array NO-: Peter Parker NO-: peterparker@mail.com Notice: Array to string conversion in /in/teaai on line 22 YES-: Array NO-: Clark Kent NO-: clarkkent@mail.com Notice: Array to string conversion in /in/teaai on line 22 YES-: Array NO-: Harry Potter NO-: harrypotter@mail.com
Output for 7.3.32 - 7.3.33
YES-: Array NO-: Peter Parker NO-: peterparker@mail.com YES-: Array NO-: Clark Kent NO-: clarkkent@mail.com YES-: Array NO-: Harry Potter NO-: harrypotter@mail.com

preferences:
154.57 ms | 402 KiB | 179 Q