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

Carlos Rojas  "Yoru No Tori"
Carlos Rojas "Yoru No Tori"
6,530 Points

print_r in a different row

sorry, as I watched the video I noticed that when I try to do the same steps, print_r returns me the the whole answer in only one row like this.

Array ( [0] => blue [1] => green [2] => brown )

but in the video I can see it in different rows like this

Array

(

[0] => blue

[1] => green

[2] => brown

)

Am I missing something?, thanks!

2 Answers

Ya your right.Because Instructor used <pre> & </pre> tags.

    <pre>
         <? php
              $num=array(1,2,3);
              print_r($num);
         ?>
     </pre>
Carlos Rojas  "Yoru No Tori"
Carlos Rojas "Yoru No Tori"
6,530 Points

Wow thanks bro, I didnยดt notice the ** & ** tags, neither did I use it before, thanks!

nope,....sorry....it was from "Markdown Cheatsheet" ...it has nothing to do with PHP....you have to just use <pre></pre> (html) tags ....