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 trialMohammad Rifqi
Courses Plus Student 3,218 Pointshow to echo this interface > array?
<?php interface rideable { public function howtoride(); }
class skateboard implements rideable { public function howtoride(){
$step = array():
$step[] = "Balance your front foot on the board.";
$step[] = "Kick, then push with the other foot.";
$step[] = "Don't fall down!";
return $step;
} } // this not work.... $p = new skateboard(); echo $p->howtoride(); ?>
1 Answer
Luksy Breezy
268 Pointsu are calling a method which returns an array.
you cannot view the contents in an array using the "echo" command.
use
<?php
print_r($p->howtoride());
?>
Mohammad Rifqi
Courses Plus Student 3,218 PointsMohammad Rifqi
Courses Plus Student 3,218 Pointsthx, and also i had an error > $step = array()';'