Modifying Array Elements Two Outputs


$languages = array("HTML/CSS",
"JavaScript", "PHP", "Python", "Ruby");

    echo $languages{4};
    //prints "Ruby"
    $languages[4] = "Python";

    echo $languages{4};
    //prints "RubyPython" why?


I don't know why the outcome is coming out with 2 names. I tried sending the whole code through but it only allowed the main important part into the question.


you modify and access elementsof the array with square brackets:

$languages[4] = "Python";
 echo $languages[4];


I changed them all to be the same symbols and tried and changed them around but it still outputs "RubyPython". I tried to change the numbers but it just changes the output word/words.


The answer was to remove the first echo line and it cancels out the problem.