How to get xdebug var_dump to show full object/array

前端 未结 6 1615
花落未央
花落未央 2020-11-27 08:57

I am using xdebug (php_xdebug-2.1.2-5.3-vc9.dll) on WAMP. When I use var_dump on a large object or variable it does not show the full variable.

         


        
6条回答
  •  庸人自扰
    2020-11-27 09:27

    I know this is a super old post, but I figured this may still be helpful.

    If you're comfortable with reading json format you could replace your var_dump with:

    return json_encode($myvar);
    

    I've been using this to help troubleshoot a service I've been building that has some deeply nested arrays. This will return every level of your array without truncating anything or requiring you to change your php.ini file.

    Also, because the json_encoded data is a string it means you can write it to the error log easily

    error_log(json_encode($myvar));
    

    It probably isn't the best choice for every situation, but it's a choice!

提交回复
热议问题