Home > Article > Backend Development > PHP learning: Understand the differences between echo, print, and vardump statements
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'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'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!