i am trying to do some examples to understand more easily php, but when i try them, this happens:

(here is the source code)

<html>
<body>
<?php
$arr=array("one", "two", "three");
foreach ($arr as $value)
{
  echo "Value: " . $value . "<br />";
}
?>
</body>
</html>

and the output is "; } ?> help plz...

Hello.

I think that you have not installed and configured web server and php.

This is the only reason for not executing your php code.

- Mitko Kostov

i'm going mad... i've installed and reinstalled my php software and nothing works... it's v 5.2.3, along with apache 2.2.4... nothing works...

If you are using Windows, have you tried Wampserver?
http://www.wampserver.com/en/

One simple install for Apache, PHP, and mySQL. Works immediately without having to screw around with the various config files.

(Linux has LAMP packages available I believe if you need those instead)

What software do you use ? Pure Apache and PHP installation or all-in-one packet such as WAMP, XAMPP...

- Mitko Kostov

nope... i downloaded php, apache and mySQL individually... meaning with no packages...

I recomend you to download and install as Ezzaral wrote WAMP. It's easy to use and configure.

- Mitko Kostov

i just installed Wamp 5.1.7.2, and guess what... nothing changed... i'm going nuts now...

Don't be insulted if this is an obvious question, but did you start Wampserver? And is the file saved as ".php"?

Edit: Your code as posted runs just fine here on my machine.

actually i saved as .htm, which has a php script... should i save it as a php anyway?

This article has been dead for over six months. Start a new discussion instead.