Sometimes the requests are a bit misleading ..?


#1

Sometimes the requests are a bit misleading .. ?

one example of possibly many :
Modify the echo statement on line 9 to display the fruit in the middle of the array (that is, it should echo "apples".

result :
Oops, try again.
Did you remember to use $fruits[1] in your code? Check the Hint if you need help!

what was typed in (but I wil just change it to be the simple answer .. but, I'm just saying ..) :

<html>
  <head>
    <title>Array Review</title>
  </head>
  <body>
    <p>
      <?php
        $fruits =  array('bananas','apples','pears');
        /* Your code here! */
        echo 'I love eating ' . $fruits[(count($fruits)-1)/2] /* Your code here! */ . ' too!';
      ?>
    </p>
  </body>
</html>

(also, when creating this post .. using colons wants to force selecting a smiley , and CTRL Enter just saved my post . .I was trying to bypass the force using a smiley ..)


#2

The most straightforward way in this case is to access element by its index ... but yeah, platform could be better at anticipating various solutions :slight_smile: (i.e. the output should be the bottom line)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.