3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArr=array( array( 'question' => 'First Question', 'opt' => array('A','B','c','D'), 'ans' => '3' ), array( 'question' => 'Second Question', 'opt' => array('A','B','c','D'), 'ans' => '1' ) ); function display_array($arr){ if(gettype($arr) == 'array'){ foreach($arr as $v){ display_array($v); } }else{ echo $arr . PHP_EOL; // change to BR (I used PHP_EOL just for 3v4l.org) } } display_array($myArr);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
225.08 ms | 2264 KiB | 9 Q