PHP PHP Basics Getting to Know PHP Intro to Workspaces and PHP Code

Barak TheProgrammer
Barak TheProgrammer
1,773 Points

hey, im on php basics course with Alea Holligan.

my question is about the second's video teacher's notes, i didn't understand what does she mean over there. may someone will clear it for me please? thanks :)

1 Answer

Just note that it isn't that important.

It's just explaining that echo and print are a little bit different, because print returns the value 1 and echo doesn't return anything.

Just keep in mind to try to use echo and only use print when you really have to. The echo function/method is a little but faster and is used more often.


Barak TheProgrammer
Barak TheProgrammer
1,773 Points

what does it mean "print return 1" cause as i get it print just need to output the text dont it?

The print function does print out the value of whatever you say, but it returns 1.

Returning a value isn't the same as printing a value :)

For example take a look at this:


    $someValue = print("Hi!");
    echo $someValue;


The code above will print out:


Anyway, you will learn more about functions and returning values in a future video :smile: