Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of echo,print,print_r,var_du in php7

Shulou Source: shulou.com Published: 2022-06-03 17:46:18 09月17日 Update

Editor to share with you what is the use of echo,print,print_r,var_du in php7, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Let's talk about the difference of echo,print,print_r,var_dump in php7.

1.echo

Outputs one or more strings.

2.print

The main difference from echo: print supports only one parameter and always returns 1.

3.print_r

Print easy-to-understand information about variables, and if string, integer, or float are given, the variable values themselves are printed. If array is given, the keys and elements will be displayed in a certain format. Object is similar to an array. Remember, print_r () will move the pointer of the array to the end. Use reset () to get the pointer back to the beginning.

4.var_dump

This function displays structural information about one or more expressions, including the type and value of the expression. The array will recursively expand the value and show its structure by indentation.

The difference between 5.var_dump and print_r

Var_dump returns the type and value of the expression, while print_r only returns the result, which is easier to read than debugging code using var_dump

The above is all the content of this article "what is the use of echo,print,print_r,var_du in php7?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Arrays articles expressions information content multiple pointers types structures less code elements functions parameters variables most characters strings more formatting Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Linux Redmi MariaDB Apple