Home  >  Article  >  Backend Development  >  PHP learning: Understand the differences between echo, print, and vardump statements

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

little bottle
little bottleOriginal
2019-04-24 14:10:302738browse

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.";
     ?>

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!";
?>

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!

Statement:
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