This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Arrays Forum

View Course

240 points
03540c0a50105232753abcdc053a9ca5?s=140&d=retro
Submitted by
50109010501at
almost 2 years ago

Modifying Array Elements What's wrong?

Modifying Elements



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

    echo $languages[2];
    // output "PHP"

    $languages{2} = "Paint";


    echo $languages{2};
    // output "Paint"
  ?>
</p>

0 votes

permalink

Do not print the value before making changes.

1288 points
Cd63ccf5369069002b667d4ebf703ac5?s=140&d=retro
Submitted by
sksn
almost 2 years ago

3 Comments

Picture Rakesh Thalapura almost 2 years ago

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

    // Write the code to modify
    // the $languages array!

    $languages[4]= "Sql" ;

    echo $languages[4];

  ?>

still the address persists

080a55fb321dbbc3357a74616aaea653?s=140&d=retro Henrique almost 2 years ago

Thank you! I was getting bored with this lesson...

Picture Rakesh Thalapura almost 2 years ago

you welcome!!!

Happy Coding!!!