Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.

~Alex

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:

<?php

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

?>

The code above will print out:

Hi!
1

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