Interview Questions

PHP interview questions
Web UI developer
PHP Framework

PHP Tutorial

PHP Introduction
PHP Variables
PHP Comments
PHP Operators

PHP Conditional Statements

PHP Loops
PHP functions
PHP Array


Cakephp Overview
CodeIgniter Overview
Yii Overview
Zend Overview
PHP Security
  1. PHP variables

    A variable is a memory location to store a value.In PHP the value may be a string,number,flot,array even an object of a class etc. A variable begins with the $ sign

    Rules for declare PHP variables:

    • A variable begins with the $ sign,followed by its name
    • A variable name must start with a letter or _ charactor
    • A variable name can only contain letters , number and _ charactor (A-z,0-9, and _)
    • Variable names are case sensitive $y not equal $Y

    System allocated a space for a variable only when you assign a value for it

    <?$txt="Hello world!";
    $x=5;?> .


    A php script can be write anywere in the file, A php script starts with <?php and end with ?>
    example: <?php echo "Hello world"; ?>
    This script print "Hello world" in your browser as output. The echo is a function used to print a value in the out put html

    Every code line in PHP must end with a semicolon. The semicolon is a separator between the instructions from another.If you forgot to put a semicolon,php compiler will return an error (common mistakes in programming) .
  2. In PHP, there are two basic statements to print anything in the web browser: echo and print.