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 trialammarkhan
Front End Web Development Techdegree Student 21,661 PointsStatic method quiz
The following question is no getting solved and i might be doing something wrong, i might be of negative side of php as i can only understand the question as i solved it.
The accepted parameter $size will be an array containing length and width in that order. Add a return value to the displayDimensions method that returns these values as a string "length x width".
my code
class Render{
public station function displayDimensions($size){
$size = array(
'length' => 12,
'width' = 14
return $size;
);
}
}
1 Answer
Filipe Pacheco
Full Stack JavaScript Techdegree Student 21,416 PointsHi, Ammar,
Imagine that the $size parameter already comes as an existent array. like this:
$size = array( 12, 14);
//The first element is the length and the second is the width.
So when you create the method and pass the parameter, you just need to return the length and the width of that parameter array. So how do you fetch an specific value, without even knowing its key? The step says that the first value is the length and the second, the width, so their keys are 0 and 1, in that order. You just ned to return these values, like this:
class Render {
public static function displayDimensions($size)
{
return $size[0] . " x " . $size[1];
}
}
Also pay attention in the way you called your method, you called it "station", instead of "static". You also tried to return a value inside the array, which is not possible.