Google+ Pinterest LinkedIn Tumblr +

PHP: PHP: Hypertext Preprocessor

PHP is a recursive acronym for: PHP: Hypertext Preprocessor. The PHP stands for Personal Home Page[1]. PHP is a server side programming language used mainly for creating and maintaining webpages dynamically.
The PHP official website is:

PHP is a loosely typed programming language[2]. This means that variables generally do not have to be declared before being used. Also strings can instantly be changed into integers or booleans and vice versa with no prior conversion. Another example of a loosely typed programming language is Perl. This is in contrast to strongly typed programming languages such as C, C++, C# and Visual Basic among many others[3].

PHP’s syntax is similar to that of C’s except that PHP is a loosely typed language and C a strongly typed language.

PHP is designed to work closely with HTML. It provides ways of switching to and from PHP. This means that it is very simple to embed PHP code within HTML.

To signal to the PHP processor to process your PHP code it must be contained in tags (In some cases or ). PHP must also be configured to interpret the given extension. PHP by default interprets .php and .phtml but can easily be configured differently in your server’s configuration.

This is a basic PHP Hello World program:

echo “Hello World”; // Hello World ?>

It is to be noted that generally the argument of a function (“Hello World”) must be enclosed in round brackets “(ARGUMENT HERE)”. The echo function is an exception to this rule.

Commenting in PHP is also similar to C single line comments can be made with // or # and multi line comments by enclosing the comment in /* and */.[4]

MySQL: My Structured Query Language

PHP includes functionality to work closely with many databases. The most common and most supported being MySQLMy Structured Query Language.

PHP includes many direct functions for working with MYSQL. Here is an example of a connection with a mysql database:

// Connect to database

$conn = mysql_connect(“server”,”username”,”password”);

$rs = mysql_select_db(“database name”);

// Run a mysql query

$sql = mysql_query(“SELECT * FROM table WHERE field1 = ‘value1’ AND field2 = ‘value2′”,$conn);

// See if it was succesful

if($sql) {

echo(“Succesfully connected and tested a mysql connection!”);

} else {

echo(“Error connecting or selecting from database”);




About Author

Leave A Reply