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

Arrays Forum

View Course

583 points
Submitted by
Tyler Batdorf
almost 3 years ago

PHP Arrays 7/7

When I copy and paste the code from the exercise into a file and save it as exercise.php then open it in chrome, it shows this on the page:


"; } ?>

Why is it not showing the same result as the exercise?
Here's the code:

        <title>Modifying Elements</title>
                $languages = array("HTML/CSS",
                "JavaScript", "PHP", "Python", "Ruby");
                foreach($languages as $lang) {
                    print "<p>$lang</p>";

1 vote


Do you have install php locally?

243 points
Submitted by
almost 3 years ago

1 Comment

Picture Tyler Batdorf almost 3 years ago

OH my goodness, I'm so dumb. I realize what's going on now. The code runs on the server, not locally, so you can't just open a .php file in a browser and expect it to work. Thank you!