PHP 8 Beginner Basics · 1 min read

echo vs print

Start the PHP 8 learning path »

❮ PHP 8 Home All Tutorials ❯

Should I use echo or print?

Output differences.

Example

PHP 8 Example
<?php
echo 'Hello', ' ', 'World';
print 'Hello World';

Line-by-Line Walkthrough

echo is slightly faster and can take multiple args; print returns 1.

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share

Reactions

Loading reactions…