Example of Simple PHP Code
Below the example of one of the simple First PHP and HTML page. Write the code into html editor or dream viewer and save the file firstprog.php extension.
- Create a new file in your dream viewer editor.
- Write some PHP code.
- Save the file with a .php extension.
The .php extension tells the web server that process this as PHP file. If you not save the file .php extension,
you save the file .html extension the server will not process your PHP code and the server just give output it to screen.
HTML and PHP Code
<title>PHP Syntax Example</title>
<h2>Welcome to the aonestudy PHP </h2>
echo "Hello Simple PHP!";
print” Hello Simple PHP!”
Note:- There are two type of output the text with PHP. We use the PHP echo and print command to
write “Hello Simple PHP” display this on your browser, To display the message.