6/7 modifying array elements


#1
 <html>
  <head>
    <title>Modifying Elements</title>
  </head>
  <body>
    <p>
      <?php
        $languages = array("HTML/CSS",
        "JavaScript", "PHP", "Python", "Ruby");
        
        echo $languages[1];
        // javascript
        
          $languages[1] = "php";
        
        echo $languages[1];
        //php
      
        
      ?>
    </p>
  </body>
</html>

i dont understand whats wrong it say that i need to print the modified element.


#2

Try removing the above so the code has only the two lines,

   $languages[1] = "php";
    
    echo $languages[1];

#3

thank you it worked

.......


#4

Thanks it worked for me.


#5

A post was split to a new topic: Output is showing JavaScriptphp


#11

Thank you Mtf :smiley: it really did help alot but i need to stop looking for the solutions when i get stuck (this one i was stuck for a week on so thanks) :).


#12

Submitted by
gabemaker_54fe03e276b8fef4cb0055c8_d
about 1 year ago

BUG: Instruction 2 is incorrect

Instruction 2 asks us to "use echo to output $languages" when the exercise actually wants us to output $languages[x] (where x is the index of the array element we have changed).

(Sorry this is not a question, I just wanted to provide feedback)

Me too, but I see it was provided "about 1 year ago" and is still wrong....