Learn PHP MySQL in 2 Days : Day 1 of 2

Learn PHP MySQL in 2 Days



What is PHP ?

PHP is web development language basically written by the developer and used by the developer. PHP is very easy to learn language as compared to any other language. The initial full form of PHP is Personal Home Page and now its known as Hypertext PreProcessor.

Why PHP is easy ?

PHP follows syntax as similar to C or CPP language. Basically Every programmer knows C Language and if you know C Language then its very easy to Start with PHP Language.

PHP Version History.

Version Release date
1.0 8 June 1995
2.0 1 November 1997
3.0 6 June 1998
4.0 22 May 2000
4.1 10 December 2001
4.2 22 April 2002
4.3 27 December 2002
4.4 11 July 2005
5.0 13 July 2004
5.1 24 November 2005
5.2 2 November 2006
5.3 30 June 2009


 Benefits of PHP and MySQL

  • Costing
  • Easy to Use
  • HTML embedded
  • Cross Platform Compatibility
  • Stability
  • Many Extension
  • Open Source
  • Strong User Help by Forum and Communities


 Which kind of website you can develop using PHP

  • Blog
  • Personal Website
  • E-Commerce Website
  • Advertisement Website
  • Content Website
  • Survey Website
  • Poll Website
  • Counter Website
  • Forum
  • Group Website
  • Games
  • General Website


 PHP Basic Tag (Starting and Ending Delimiter for PHP )


PHP Other Tags but Not Recommended Tags


Hello World PHP Example ( FileName: index.php)

PHP Variables

In PHP Variable are prefixed with a dollar symbol and type does not need to specify.  In PHP Variable declaration is not required. you can directly add values and type will be selected automatically by PHP.

PHP Variable Example 1

PHP Variable Example 2 (Find Sum of Two Numbers)

PHP Variable Example 3 (Contact Two String)


PHP Variable Example 4 (Contact Two String) (Wrong)

PHP Variable Example 5


Its 0 or empty string is default for all PHP Variables.


PHP Comments Format


Isset() to check Variable is Live or not


unset() to deallocate memory of Variable

 PHP Constants

In Addition to PHP Variables you can declare constants in your PHP also. Once you declare PHP Constants then you can not change value of it.

 Operators Supported in PHP

 Logical Operators

Operator Description
and Is true if and only if both of its arguments are true
or Is true if either (or both) of its arguments are true.
! Is true if its single argument (to the right) is false and false if its argument is true.


Comparison Operators

Operator Description  
== Equal
!= Not Equal
Less Than
Grate Than
<=  Lessthan or Equal to
>=  Grater than or Equal to
=== Identical True if its arguments are equal to each other and of the same type but false otherwise


Condition Checking in PHP (Conditional Control)

IF Condition Checking Example 1 (Positive / Negative as Result)


IF Condition Checking Example 2 (Positive / Negative / Zero as Result)


IF Condition Checking Example 3 ( Condition Check with === identical Operator)


Switch Statement


Looping Structure

For Loop (Same as C Language… But Be sure to Include $ before variable Name)

For Loop Example 1

 While Loop Example 1

 Do…While Loop Example 1

To Terminate Loop any time you can use break statement and you can also use continue statement.

Terminating Execution

To terminate execution any time you can exit() or die() function.



Adarsh Patel

My Self Adarsh Suryakant Patel. Currently I am working as Assistant Professor at Parul Instiute of Engineering and Technology, MCA Department, Limda, Vadodara. Major Responsibility : * Lectures * Organizing Training and Expert Sessions for * Placement and Recruitment * Faculty Representative