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 trialDamian Toczek
4,471 PointsReturn the $size array as a string?
I don't understand what they want me to do. I tried it with return $size, but that returns the array itself. So i made a foreach loop and append it to a var named $output.. and then return $output.
<?php
class Render {
public static function displayDimensions($size){
return $size;
}
}
?>
1 Answer
KRIS NIKOLAISEN
54,972 PointsThe task is looking for the string "length x width". For this you can specify the individual elements concatenated with x as
public static function displayDimensions($size){
return $size[0] . ' x ' . $size[1];
}
Damian Toczek
4,471 PointsDamian Toczek
4,471 PointsWho the heck makes such things separate? If you have a dimension, you prob make it something like ['10cm x 20cm','5cm x 10cm']. If you make it something like ['10cm','50cm','14cm'] those are not dimensions, just random values inside an array. I was expecting something like ['10cm x 20cm']... Either they fix these arrays or they show how the array looks like.