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 trialMarwa Rashad
4,198 PointsIn the last objective of Static functions, I dont know what should I pass in the static method?
Should I pass the $room->getDimensions()? How would it work while the static function is expecting an array $size). I dont get it. Please help.
<?php
class Render {
public static function displayDimensions($size) {
return $size[0]. " x ". $size[1];
}
public static function detailsKitchen($room) {
return "Kitchen Dimensions: ". Render::displayDimensions($room->getDimensions());
}
}
?>
1 Answer
Chris Shaw
26,676 PointsHi Marwa Rashad,
When working with static types in PHP there is a special keyword called self
which allows us to access the statically typed properties and methods of an class. In this case you would substitute Render::
with self::
.
Happy coding!
Marwa Rashad
4,198 PointsMarwa Rashad
4,198 PointsHello Chris! Thanks a lot. Still I have tried this and still not working: