Home >Backend Development >PHP Tutorial >How to print out an array within an array?

How to print out an array within an array?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-04 09:20:431745browse

<code>    <?php
  $ar=array(array(5,'x'),'q',5);
  echo implode($ar);
    ?></code>

Like the above code, how to print the contents of array(5,'x')?

Reply content:

<code>    <?php
  $ar=array(array(5,'x'),'q',5);
  echo implode($ar);
    ?></code>

Like the above code, how to print the contents of array(5,'x')?

foreach($ar as $v){

<code>    if(is_array($v)){ //如果值是一个数组
        foreach($v as $vv){
            echo $vv."<br>";
        }
    }else{ //不是数组直接打印
        echo $v."<br>";
    }
}</code>

!!!
var_dump Don’t you know?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn