Difference in PHP echo, print, print_r, var_dump of

Difference in PHP echo, print, print_r, var_dump of

1.echo

One or more output strings.

2.print

And echo the main difference: print supports only one parameter, and always return 1.

3.print_r

Print variable information on easy to understand, if given a string, integer or float, the value itself will be printed variable. If a given array, and the key element will be displayed according to a certain format. object like arrays. Remember, print_r () array pointer will move to the last side. Use reset () allows the pointer back to the beginning.

4.var_dump

This function displays the configuration information about one or more expressions, including the type and value of the expression. Recursively expand the array values, indented by its structure.

The difference 5.var_dump and print_r

var_dump return type and value expression print_r return only results than using var_dump debug code easier to read.

Released four original articles · won praise 0 · Views 57

Guess you like

Origin blog.csdn.net/weixin_45645113/article/details/104661007