How to echo or print an array in PHP?

前端 未结 11 1428
春和景丽
春和景丽 2020-11-22 17:18

I have this array

Array
(
  [data] => Array
    (
      [0] => Array
        (
          [page_id] => 204725966262837
          [type] => WEBSITE         


        
11条回答
  •  名媛妹妹
    2020-11-22 17:36

    You can use print_r, var_dump and var_export funcations of php:

    print_r: Convert into human readble form

    ";
     print_r($results); 
    echo "
    "; ?>

    var_dump(): will show you the type of the thing as well as what's in it.

    var_dump($results);
    

    foreach loop: using for each loop you can iterate each and every value of an array.

    foreach($results['data'] as $result) {
        echo $result['type'].'
    '; }

提交回复
热议问题