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...

That code looks fine to me.

but that's the output i get... and the code is exactly the same...

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...

this code is so fine
are u sure the code u r trying is the same u posted !!!!!

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?

You should save the file with php extension.

- Mitko Kostov

i get the exact same output...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.