-1

Trying to study some outputs of arrays and object by using for example print_r($wp_query); but it's really hard to read it, i have searched but what I found does not format well nested arrays, I wonder if there is a solution for this? Thank you

Botond Vajna
  • 1,295
  • 1
  • 10
  • 22

1 Answers1

0

Please take a look at VarDumper component. It could be used as a standalone and easily improve your array or object output.

composer require --dev symfony/var-dumper


<?php

require __DIR__.'/vendor/autoload.php';

$array = [
    [
        [
            [
                [
                    'some_key' => 'some_value',
                ],
            ],
        ],
    ],
];

dump($array);

The output would be the following.

^ array:1 [
  0 => array:1 [
    0 => array:1 [
      0 => array:1 [
        0 => array:1 [
          "some_key" => "some_value"
        ]
      ]
    ]
  ]
]
Mikhail Prosalov
  • 4,155
  • 4
  • 29
  • 41