PHP -- Arrays -- Editor doesn't accept code, despite it working, and meeting the requirements. What to do?

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

I am working on: PHP Arrays part 3

https://www.codecademy.com/courses/web-beginner-en-8a35h/0/3?curriculum_id=5124ef4c78d510dd89003eb8#

The exact instructions i have are:

“Create an array called $friends and put the names of three of your friends in it. Since each friend’s name is a string, make sure to write it between quotes.”

<In what way does your code behave incorrectly? Include ALL error messages.>
Code does compile correctly, but the editor won’t accept my solution. The error message it states is: “Oops, try again. Did you remember to put at least three elements in your array? Make sure each one is a string in quotes!”

I see 3 strings here clearly, and they are all wrapped in quotes so I don’t know what the issue is (unless PHP has some strange regex feature that i’ve ran into). I’m guessing there is a subtlety i’m missing.

``` My First Array

<?php $friends = array("Matt Lee", "Mary Mercanti", "Travis Vanderstad"); ?>

<do not remove the three backticks above>

After some additional debugging I've concluded their grader has a flaw. Since the following DOES pass:

My First Array

<?php $friends = array("do", "re", "mi"); ?>


It seems as soon as I introduce a space and another character the test case fails. Such as

My First Array

<?php $friends = array("do a", "re", "mi"); ?>

1 Like

Lazy code checker! :slight_smile:

This old course is on the list for rewriting so there are no bug fixes being made at this time.

Good on you for troubleshooting it!

@frogeyedpeas,
With a google search something to read
php array explained site:php.net
http://php.net/manual/en/function.array.php