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 Static

julian Ellis
julian Ellis
3,542 Points

Can anyone please explain why this isin't working!!!!!!

The accepted parameter $room will be an object which has a method named getDimensions. Add a return value to the detailsKitchen method that displays "Kitchen Dimensions: length x width", where length x width is returned from the displayDimensions method.

You will need to call the static method displayDimensions from within the Render class and pass the dimensions from the $room object using the getDimensions method

Final Output Example: Kitchen Dimensions: 12 x 14

<?php

class Render { public static function detailsKitchen($room) { $output = "Kitchen Dimesions:"; $output .= self::displayDimensions($room->getDimensions()); return $output; }

public static function displayDimensions($size) { $output = $size[0] . " x " . $size[1]; return $output; } } ?>

2 Answers

I need answer for this too please.

julian Ellis
julian Ellis
3,542 Points

<?php

class Render { public static function displayDimensions($size) { $output = $size[0] . " x " . $size[1]; return $output; }

public static function detailsKitchen($room) { $output = "Kitchen Dimensions:" . " "; $output.= self::displayDimensions($room->getDimensions() ); return $output; } }

?>