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 trialNick Tsamis
Courses Plus Student 4,267 Pointsi want some help with this challenge task
how i can fixed this?
<?php
class Render {
public static function displayDimensions($size){
$size = array('lenght', 'width');
return implode(" x ", $size);
}
}
?>
2 Answers
Nish Patel
1,103 PointsThis should help you:
class Render {
public static function displayDimensions($size)
{
return $size[0] . " x " . $size[1];
}
}
?>
Mark Giles
7,049 PointsThis is correct in regard to the code challenge. The challenge is specifically looking for the $size array with specified index values ($size[0] and $size[1]). To use implode in your own project, you could use the method I show in a separate comment.
Nick Tsamis
Courses Plus Student 4,267 Pointsyes i made this at working thank you very much!!Nish:)
Nick Tsamis
Courses Plus Student 4,267 PointsThank you Mark!:)
Mark Giles
7,049 PointsMark Giles
7,049 PointsYou are setting the values in the array to the strings 'lenght' and 'width' which produces an array of the two strings (words). I believe what you want is to pass the function dimensions and have it display the numbers with an x in between them. If this is case you would do something like this:
The function is able to take the dimension values as an array, implode them by adding the " x " between them, and return the desired display string.