PHP函数printarray()不能输出对象
程序员文章站
2022-04-18 13:28:28
...
PHP函数printarray()缺点: 不能输出对象 print_r()可以输出对象
- printarray($_REQUEST);
-
function printarray($strs,
$numbers = 0) { - $space = ''; //输出字符前的空格
- for($i=0;$i$numbers * 2;$i++)
- $space .= ' ';
- echo 'Arraybr/>'.$space.'(br/>';
- foreach ($strs as $key=> $value ) {
- if (is_array ( $value )) {
- $numbers ++;
- echo $space. '['.$key.'] => ';
- printarray($value, $numbers);
- } else {
-
echo $space.' ['.$key.']=> '
.$value.'br/>'; - }
- }
- echo $space. ')br/>';
- }
PHP函数printarray()输出的内容如下
- Array
- (
- [ECS] => Array
- (
- [visit_times] => 2
- )
- [uchome_loginuser] => yoyorose
- [rrm_cookietime] => 2592000
- [rrm_indextype] => classics
- [uchome_mytemplate] => blue
- [rrm_loginuser] => yoyorose
- [rrm_activationauth] => 6f474pFbxW4oV
/XdtU+eyoMUxpRCx6A+0GMR4SUR/8GlagURxA- [ZDEDebuggerPresent] => PHP,phtml,PHP3
- [uchome_auth] => 821bVB9QFgrH+4uv07tQ6q
CRYK9OueeM/j5gqXCJfmUZh3gptW6dP3phCqPufV
ZnYY3qCtuW7h1vrLxEemQG- [uchome_viewuids] => 10_1_2_4_11_8_9_7
- [uchome_space_top_show] => 1
- [uchome_space_top_experience] => 2
- )