I'm just trying to echo a string to the browswer with the following code:

    <!DOCTYPE html>
    <html>
    <body>
    <h1>Hello World!</h1>
    <?php
    echo "My first PHP script!";
    ?>

    </body>
    </html>

but it doesn't show up in the browswer. The "Hello world!" header shows up but not the php statement. I know it must be something very simple. Could someone help me out?

Are you viewing this locally? Do you have a web server with php running? Is your script a PHP file?

In other words: PHP scripts should have a .php exstension (not .html) and should be run on a PHP enabled web server (could be localhost or a server embeded into your IDE).

commented: good advice. +4
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.