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

Software Singh
Software Singh
7,123 Points

got the solution but not able to pass this challenge

I have successfully returned the desired output but still, I am not passing this challenge

index.php
<?php

class Render {

  public static function displayDimensions($size){


    return $size['0'] . ' x ' . $size['1'];
  }

}

$obj = new Render();

echo $obj->displayDimensions(array(12 , 14 ));
?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You are so close! I assume it's the second step of the challenge you're stuck on. The problem is that you're using the strings 0 and 1 for your indexes instead of the integers 0 and 1 for your indexes. This won't work. So this line:

return $size['0'] . ' x ' . $size['1'];

Should be:

return $size[0] . ' x ' . $size[1];

Hope this helps! :sparkles:

Software Singh
Software Singh
7,123 Points

thanks! that worked well....