Features of PHP - LEARNING PHP AND MYSQL (2015)

LEARNING PHP AND MYSQL (2015)

Features of PHP

They are as follows.

· Server side- PHP won’t execute within the local machines web browser, instead it will be executed in the web server.

· Cross plat formed- This feature allows the PHP script to run and executed on any operating system and web server.

· HTML embedded language- This means the commands and statement of PHP is already embedded in the HTML document.

working-of-php.png

Working of PHP

PHP supports many databases and it is open source software which is free to download and use.

Uses of PHP

· PHP can be used for creation of dynamic website.

· For building template that would make the site maintenance easy.

· For creation of graphics on the fly.

· For maintaining the differentiation of the type of content to be served on the basis of the users browser, IP address, date and time and various other details.

· For conducting a survey online.

· To connect databases with the web. For e.g. oracle and My SQL.

· Helps in providing a link of communication with external web.

· It performs read and process XML.

Simple scripting in PHP

<HTML>

<HEAD>

<TITLE>

</HEAD>

<BODY>

<?

//HELLO IN PHP

PRINT (“HELLO”);

?>

</BODY>

</HTML>

The PHP statement is follow-

<? PRINT (“HELLO”) ;?>

This would display the message “hello” in the window browser.

The PHP print function displays the value with the parenthesis as output in new window.

Important things about PHP scripts-

· PHP is case sensitive.

· PHP statements are stated between <? ?>.

· It always ends with semi-colon.

· Comments can be added using // in the beginning of the line.

· PHP file should not have .html extension.

· File should have .PHP extension.

· If the file don’t have .PHP extension nor has .html extension the file won’t found, parsed and executed.

Advantage of PHP with high security i.e. safe mode-

· The ownership should be same for the script being executed and file from which it is read or written.

· The directory should be owned by the owner of the PHP script.

· PHP cannot execute external programs which are not from the system.