PHP learning: Understand the differences between echo, print, and vardump statements

little bottle
Release: 2023-04-06 10:20:01
Original
2740 people have browsed it

We all know that PHP has a lot of print output, PHP echo, print, vardump, so what is the difference between them? Below I will take you to learn more about it, I hope it can be helpful to you.

1.echo statement

echo - can output more than one string

   <?php
      echo "<h2>www.dc3688.com</h2>";
      echo "Hello world!<br>";
      echo "I&#39;m about to learn PHP!<br>";
       echo "This", " string", " was", " made", " with multiple parameters.";
     ?>
Copy after login

2, print() statement

print - can only output one String, and always returns 1

<?php
print "<h2>www.dc3688.com</h2>";
print "Hello world!<br>";
print "I&#39;m about to learn PHP!";
?>
Copy after login

3, vardump prints the array

Prints all objects and views the data structure inside the object

Note that echo is slightly faster than print because It returns no value.

Related tutorials: PHP video tutorial

The above is the detailed content of PHP learning: Understand the differences between echo, print, and vardump statements. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template