PHP的var_dump()与print_r的() [英] php var_dump() vs print_r()

查看:128
本文介绍了PHP的var_dump()与print_r的()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是之间的var_dump在吐出一个数组作为字符串方面的差异()的print_r()

推荐答案

的var_dump 功能显示器的结构有关变量/ EX pressions包括它​​的类型信息即可。数组与缩进显示结构值递归探索。这也显示了数组值和对象属性的引用。

The var_dump function displays structured information about variables/expressions including its type and value. Arrays are explored recursively with values indented to show structure. It also shows which array values and object properties are references.

的print_r()显示有关的方式,是由人类可读的一个变量的信息。数组值将在格式psented $ P $的节目元素。类似的符号用于对象。

The print_r() displays information about a variable in a way that's readable by humans. array values will be presented in a format that shows keys and elements. Similar notation is used for objects.

示例:

$obj = (object) array('qualitypoint', 'technologies', 'India');

的var_dump($ OBJ)将显示如下输出在屏幕。

var_dump($obj) will display below output in the screen.

object(stdClass)#1 (3) {
 [0]=> string(12) "qualitypoint"
 [1]=> string(12) "technologies"
 [2]=> string(5) "India"
}

的print_r($ OBJ)将显示如下输出在屏幕。

And, print_r($obj) will display below output in the screen.

stdClass Object ( 
 [0] => qualitypoint
 [1] => technologies
 [2] => India
)

更多资讯

  • var_dump
  • print_r

这篇关于PHP的var_dump()与print_r的()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆