php 如何使用var_dump获取所有元素?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16278102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:50:00  来源:igfitidea点击:

How to get all elements with var_dump?

php

提问by csaron92

How do I get all of elements with var_dump? I have a huge array but var_dumpprints only the first x elemets, and I need all of them to check if my sql is correct.

我如何获得所有元素var_dump?我有一个巨大的数组,但var_dump只打印前 x 个元素,我需要所有这些元素来检查我的 sql 是否正确。

回答by Maulik Vora

try

尝试

echo '<pre>';
print_r($your_array);
echo '</pre>';

This will not show you type/size of the array elements as var_dump but will show you full array.

这不会将数组元素的类型/大小显示为 var_dump,但会显示完整数组。

回答by Dom

Try print_re.g.

尝试print_r例如

print_r($myarray);

回答by Richard de Wit

Use print_r:

使用print_r

<pre>
<?php
    print_r($var); 
?>
</pre>

It's a good way to see your array. The preelement formats it nice and readable.

这是查看阵列的好方法。该pre元素将其格式化为美观且可读。