In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "what is the difference between php printing and output". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the difference between php printing and output".
Difference: 1, print () can print only one variable, while echo can print multiple variables; 2, "print_r ()" will format the array or object and print it out, while "var_dump ()" will not only format the array or object, but also display the type.
This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer.
What is the difference between php printout
I. print processing
Print (); / / output string printf (); / / output format string print_r (); / / print variable echo; sprintf () in an easy-to-understand format; / / return format string var_dump (); / / print information about variables var_export (); / / output or return a string representation of a variable
II. Differences
1. The difference between print and echo
Both print and echo are language structures.
Print can only print one variable when printing, while echo can print multiple variables. If multiple variables are printed at the same time, separated by commas, it is more efficient [recommended].
2. The difference between printf () and sprintf ()
Printf () can be exported according to the format and directly to the cache.
Sprintf () returns and does not output.
3. The difference between print_r () and var_dump ()
Print_r () will format the array / object and print it out [to help us troubleshoot some errors or results]
Var_dump () also has the function of print_r (), and var_dump () also displays the type of each.
Fundamental difference:
Such as: print FALSE, print_r () will have nothing, just equivalent to echo a FALSE, nothing; print_r () if you print a TRUE, the result is not true but 1, so in the judgment of some results, there will be some errors, then [recommend using var_dump ()].
4. The difference between var_export and var_dump ()
Var_export () is to format and output the content (such as an array). Of course, you can also give the following parameter a true, which will return
For var_export (), the value it returns conforms to the syntax structure of PHP (for example, a string it prints out can be used as the syntax structure of PHP), while var_dump () cannot, var_dump () just helps us debug to check our error message or result information.
Thank you for your reading, the above is "what is the difference between php print and output" content, after the study of this article, I believe you have a deeper understanding of the difference between php print and output of this problem, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.