0

I have a simple "Hello World" code on a server that has PHP on it. Here is the code:

<!DOCTYPE html>
<html>
<body>

<?php
ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
?>

</body>
</html>

However, what I get on a page (in any browser) is this:

"; echo "Hello World!

"; EcHo "Hello World!

"; ?>

Is there any mistake in my code?

jaguar
  • 15
  • 4
  • Have you saved your page as .php extension? Because when I run the code its showing - Hello World!
    Hello World!
    Hello World!
    – Mayank Pandeyz Sep 06 '16 at 04:50
  • 2
    Take a look at this, I am sure it will solve your problem http://stackoverflow.com/a/7639297/1207414 – user1207414 Sep 06 '16 at 04:51
  • The code is working fine for me, with expected result. – AkshayP Sep 06 '16 at 04:52
  • I have checked the full code and its working great. Just check whether you have started apache server if you are using wamp, xampp or something. And also check whether you have saved you code with .PHP extension. – Vignesh Chinnaiyan Sep 06 '16 at 04:54
  • I have checked online in http://phpfiddle.org/ in their codespace. Its working as expected, its output is `Hello World! Hello World! Hello World!` – Vignesh Chinnaiyan Sep 06 '16 at 04:57
  • Your file needs to be saved as `.php` to be processed as PHP. You also need PHP & a webserver installed where you are testing this – Darren Sep 06 '16 at 05:06
  • @Darren - Yes! Thank you Darren and all others for your kind help! The solution is .php extension instead of .HTML one. – jaguar Sep 06 '16 at 05:37

0 Answers0