7 Putting It all together

php

#1

I'm having a great deal of difficulty completing this last task. I have tried several times, but the editor seems frozen on my unfinished code, and I can't reset or change it at all, very frustrating.

Below is a copy of the code that I would like to include, can anyone offer any feedback? (I am trying to keep it simple).

<?php
      // On the line below, create your own associative array:
        $myArray = array('yellow' => 'banana',
                        'orange' => 'orange', 
                        'red' => 'apple', 
                        'brown' => 'peach', 
                        'green' => 'pear', 
                        'pink' => 'grapefruit');

      // On the line below, output one of the values to the page:
        echo $myArray['red'];
          
      // On the line below, loop through the array and output
      // *all* of the values to the page:
        foreach ($myArray as $colour=>$fruit) {
            echo $colour . ': ' . $fruit '<br />';
            }
     
      ?>

#2

this you do right:

echo $colour . ': ' . $fruit

a dot between variable and ':' to joint it all together, but then you don't have a dot between $fruit and <br />;


#3

you have a dot missing in line 22
echo $colour . ': ' . $fruit .'
';


#4

Ah good one, I hadn't thought about that, thanks. Hopefully I can try it out when the screen finally resets itself


#5

The problem I currently have is my editor is frozen in what appears to be an infinite loop, and despite all my efforts I can't reset it!! I've tried searching the help topics but I still can't find a solution. SOOOOO FRUSTRATING!!!! as this is the last exercise in the PHP course.

If anyone from Codecademy is watching this can you please fix????


#6

Navigate to lesson 6.
Set screen zoom high enough to hide the preview window. This will turn off auto-run.
Navigate to lesson 7
Above your code add this line:

<?php else ?>

This will force a ParseError and disable preview auto-run.

Now restore the zoom to 100% and fix/complete your code. When ready to submit, just remove the above line.


#7

LEGEND!!! Thank you soo much, that fixed it, finally I can move onto javascript!