Learn PHP:3-Create Your First Simple PHP Script Using the .php Extension

Posted: September 29, 2010 in PHP
Tags:

In order for a web browser or server to process php code, your page must have a [ .php ] extension.

Instead of:   my_webpage.html
Name it:       my_webpage.php

Now let’s create a basic PHP script. Open your favorite HTML editor and create a new web document. Remember to save it as a .php extension to make sure it will process correctly.

Place the following code into the document, save it, and open it using a browser:

The PHP tag opening and closing makes a nest, or more properly termed “block”. Represented in many HTML editors as a block. There are several ways to open and close a PHP block.

Here are the examples of the ways you can script a PHP block’s opening and closing tags:

The standard type tag will work on any server configuration with PHP installed. To allow short tags to work on in your scripts if they do not already by default, you must configure your php.ini script on server.

Inside of php.ini you just add this line to enable short php tag usage:

short_open_tag = On;

Advertisements
Comments
  1. You can edit audio files with audacity.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s