3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(); $arr["TextosCodificados"]["TextoCodificado"]["0"]["QualificadorAssunto"]["0"] = "ALL"; $arr["TextosCodificados"]["TextoCodificado"]["0"]["Texto"] = "Vnd mer.adq.rec.ter.op.mer.sj.rg.sub.trb.cnd.sub.t"; $arr["TextosCodificados"]["TextoCodificado"]["1"]["QualificadorAssunto"]["0"] = "AAI"; $arr["TextosCodificados"]["TextoCodificado"]["1"]["Texto"] = "Protocolo ICMS 18809 e 1192012 ICMS Retido Art 313W"; $arr["TextosCodificados"]["TextoCodificado"]["2"]["QualificadorAssunto"]["0"] = "IVN"; $arr["TextosCodificados"]["TextoCodificado"]["2"]["Texto"] = "Pedido Interno:0000283278 ID da Carga:"; function teste($arr) { $ret = array() ; foreach($arr as $k => $v) { if(is_array($v)){ $ret = teste($v); } else { //var_dump($k.' - '.$v); } } return $ret; } $rst = teste($arr); var_dump($rst);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
array(0) { }

preferences:
240.22 ms | 403 KiB | 287 Q