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 (Retired) PHP Datatypes Arrays

What's print_r

It is mention that the print_r was mention, but going through all the videos, it was never mention till now. Did I miss something?

9 Answers

Jeff Jacobson-Swartfager
Jeff Jacobson-Swartfager
15,419 Points

Hello Christina!

The official PHP Manual is super helpful for answering questions like this. According to the manual's page on print_r, it "Prints human-readable information about a variable".

I hope that helps!

Thank you. Tho I was asking what video he mentions the print_r code as he stated he said it earlier. Will bookmark that link tho. Thanks.

Jeff Jacobson-Swartfager
Jeff Jacobson-Swartfager
15,419 Points

Ah, I see. I'll keep my ears out for that and post a link to the video here when I find it.

Thanks

Daniel Dou
Daniel Dou
2,014 Points

Hi Christina,

I'm going through the course, and had the same problem.

He mentioned that he talked about the print_r code earlier, but there was no video about it.

I think overall, the PHP Basics course has been quite messy so far, with quite a number of things missing. A lot of videos seem to be incomplete.

A number of things asked in the Quizzes, but not covered in the lessons. I think some videos are missing.

Michael Fish
Michael Fish
7,804 Points

print_r is a really useful tool for debugging your php code.

Say you are trying to take a previously written php object and access some of the variables contained inside of it. You can use print_r to print everything contained inside of the object to the page to quickly discover what you need

Thank you Michael for that.

I'm going to say that they updated the previous videos where he may have originally used print_r instead of var_dump, us watching the new videos he never mentions it, only logical explanation that makes sense to me.

Unless, it was intentional to get newbie programmers the whole feel for, finding info on your own as this is one of many skills programmers need to have..everything gets updated if you can't find out what has changed or are incapable of looking up information in the documentation for the language you are using, programming life will be hard.

Marc Spears
Marc Spears
1,680 Points

I agree with the sentiment Randy Fournier , but I am paying for these courses. Treehouse should have their stuff together. I've seen other comments like this on previous videos, all several months old, and no one from Treehouse ever replies or has fixed the issue. I'll be taking my training elsewhere.

Ed Everett
Ed Everett
1,566 Points

I have also experienced this problem.

I am happy to pay for these courses, but for this kind of thing to, not just be overlooked but still not fixed nearly half a year on - it is simply not acceptable. Please fix these problems, Treehouse, or I will be taking my money elsewhere!

Steve Langenbrunner
Steve Langenbrunner
3,326 Points

Glad I am not the only one who came across this.

Did you find missing information like "print_r" anywhere else in the PHP developer track Daniel Dou? Is there anyway to contact Hampton and let him know about the missing information?

Joseph Springer
PLUS
Joseph Springer
Courses Plus Student 1,914 Points

While he did not talk about print_r in any earlier videos, he did speak about var_dump, which is similar. For the curious I found a great comparison of the two on stack overflow: http://stackoverflow.com/questions/3406171/php-var-dump-vs-print-r

Phong Pham
Phong Pham
8,217 Points

So what's the difference between print_r and var_dump ?