Modifying Array Elements


Here is my code:
    <title>Modifying Elements</title>
        $languages = array("HTML/CSS", "JavaScript", "PHP", "Python", "Ruby");
        // Write the code to modify
        // the $languages array!
        echo $languages[1];
        echo $languages[1];

Here is what I get:


What is happening?

Even if I try the sample code on the left that is:

$myArray = array("red", "blue", "yellow");

echo $myArray[1];
// outputs "blue"

$myArray[1] = "green";

echo $myArray[1];
// outputs "green"

I get:


echo does not add new line character so the two strings looks get glued.

same thing true for your updated code.


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