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 Object-Oriented PHP Basics Building the Recipe Cleaning Up the Class

György Varga
György Varga
19,198 Points

Can you please have a look at my 'Challanges'?

Hi!

I made the challanges included in the Teacher's Note. I made all of them, but I don't understand the third challange, because in the first and second task I also returned the name of the ingredients in two different ways. Is it good this way? https://w.trhou.se/1cjq5jo0cw

Thank you for your help!

1 Answer

Well congrats for being ambitious. I can't open a console in your snapshot, so I don't know how your returns came out in tasks 1 and 2. So this is just a general suggestion. You can loop through the $ingredients array in a foreach loop, inside of html table tags to format. Something like this:

<table border = "1"> <thead> <th style = "padding-right: 5px;">Item</th> <th>Amount</th> <th>Measure</th> </thead>

<?php foreach ( $ingredients = $ing -> more pseudocode) ) { ?>

<tr> <td> <?php echo "<td>" . $ing . " ?> </td>

</tr>

<?php } ?>

You'd have to wrap the logic in php tags, including the opening of the foreach loop and closing curly brace. The echos also have to be wrapped in php tags.

Let me know if you have any luck. :)