Output is showing JavaScriptphp


#1

Still having issues with this.

    <?php
       $languages = array("HTML/CSS",
        "JavaScript", "PHP", "Python", "Ruby");
        
        echo $languages[1];
        // javascript
        
          $languages[1] = "php";
        
        echo $languages[1];
        
      ?>

Any suggestions on what to do here? My Output is showing JavaScriptphp, rather than just one. Think that's a system error?


6/7 modifying array elements
#2

echo does not include any white space. We have to add it.

echo '<br><br>'

#3

I had a similar problem with that, but now i know where we went wrong. the output should be just one instead of two. Thats what the system wants us to do. delete the first echo on the $languages[1];
after that your code should look likes this:
$languages[1];
//we dont have to print javascript
$languages[1] = "php";

echo $languages[1];
// prints out your new assigned output


#4

A link to the exercise is SOOOO helpful...

https://www.codecademy.com/en/courses/web-beginner-en-8a35h/0/6

Instructions
In line 8, there's an array named $languages.
1. Change an item in the $languages array. You can take your pick!
2. Then use echo to output $languages.

Essentially, the first echo is not expected. When both print out (with a line break),

        echo $languages[0];
        echo '<br>';
        $languages[0] = "HTML5/CSS3";
        echo $languages[0];

we get this SCT error message:

It looks like you printed 'HTML/CSS'--that's one of the original elements! Make sure to print your modified element.


#5

:wink: yupzz you are saying absolutely right.. but still system is showing error ....


#7