About Us

Breaking News

Recent Post

Featured Articles

Monday, January 12, 2015

What is PHP? Why PHP? What is a PHP File? How to install PHP?

What is PHP?

PHP stands for PHP- Hypertext Preprocessor.
PHP is a server-side scripting language, like ASP.
PHP scripts are executed on the server.
PHP supports many databases(MYSQL, INformix, Oracle,Solid,Sybase,Generic ODBC, PostgreSQL, etc.)
PHP is an open source software (OSS).
PHP is free to download and use.

What is a PHP File?

PHP files may contain text, HTML tags and scripts.
PHP files are returned to the browser as plain HTML.
PHP files have a file extension of ".php",".php3",or".phtml"


Why PHP?

PHP runs on different platforms (Windows, Linux, Unix, etc.)
PHP is compatible with almost all servers used today(Apache, IIS, etc.)
PHP is FREE to download from the official PHP resource: www.php.net
PHP is easy to learn and runs efficiently on the server side

PHP Installation
What do You Need?

Download PHP FREE
Download PHP for free here: http://www.php.net/downloads.php

Download MySQL Database FREE
Download MySQL for free here: http://www.mysql.com/downloads/index.html

PHP Syntax
NOTE- You cannot view the PHP source code by selecting "view source" in the browser- you will only see the output
from the PHP file, which is plain HTML. This is because the scripts are executed on the server before the result
is sent back to the browser.

A PHP scripting block always starts with <?php and ends with?>. A PHP scripting block can be placed anywhere in the document.
On server with shorthand support enabled you can start a scripting block with<? and end with?>.

However, for maximum compatibility, werecommend that you use the standard form(<?php) rather than the shorthand form.
<?php
?>

A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.

Below, we have an example of a simple PHP script which sends the text"Hello World" to the browser:

<html>
<body>
<?php
echo"Hello World";
?>

Each code line in PHP must end with a semicolon(;). The semicolon is a separator and is used to distinguish one set of instructions from another.

There are two basic statements to output text with PHP: echo and print. In the example above
we have used the echo statement to output the text "Hello World".


Comments in PHP
In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.

<html>
<body>
<?php
//This is a comment
/*
This is a comment
block
*/
?>
</body>
</html>


The string functions are part of the PHP core. There is no installation needed to use these
functions.

PHP: Indicates the earliest version of PHP that supports the function.

Function                                                             Description
addcslashes()                                              Returns a string with backslashes in front of the specified characters.

addslashes()                                               Returs a string with backslashes in front of predefined characters.

bin2hex()                                                    Converts a string of ASCII characters to hexadecimal values

chop()                                                        Alias of rtrim()

chr()                                                           Returns a character from a specified ASCII value.

chunk split()                                               Split a string into a series of smaller parts

convert cyr string()                                     Converts a string from one Cyrillic character-set to another

Convert uudecode()                                    Decode a uuencoded string

Convert uuencode()                                    Encodes a string using the uuencode algorithm

count chars()                                              Returns how many times an ASCII character occurs within a string and returns the information.

crc32()                                                       Calculate a 32-bit CRC for a string

crypt()                                                        One-way string encryption (hashing)

echo()                                                        Outputs strings

explode()                                                   Breaks a string into an array

fprintf()                                                      Writes a formattedstring to a specified output stream

get html translation table()                         Returns the translation table used by htmlspecialchars() and htmlentities()

hebrev()                                                     Converts Hebrew text to visual text

hebrevc()                                                   Converts Hebrew text to visual text and new lines(\n) into <br/>

html entity decode()                                   Converts HTML entities to characters

No comments:

Post a Comment

About Us

BLOG HTMLHOUR WWW.HTMLHOUR.COM

Gallery

Find Us On Facebook