Saturday 26 July 2014

Filled Under:

Variable in php

Variables in PHP

Variables are used  for store different type of values, like text , numbers.
When a variable is declared, it can be used again anywhere in your script.
All variables in PHP start with a $ sign symbol.
Example for declaring php variable
$variable_name=value;
Php is loosly typed language a php variable can store all type of value it does not need to specify one type of variable.

 Rules for declaring variables:

             Rules for naming php variable is jst like c++ variable.
·         A variable must be start with letter or underscore(_).
·         It not includes the space.

String Variables in PHP:

  For strings In php we simply declare a variable as show above and assign it string value in double quotes.

For example:

 <?php

$text=”hello umer”;

echo $text;

?>

We use the echo for print the value in php.

Concatenate strings:

                     For concatenate different strings with each other we use dot (.) operator in php .

For examples:

 <?php

$text=”hello umer”;

$text_2=”h r u?”;

$text_3=$text. $text_2;

 echo $text_3;

?>

Output:

          Hello umer h r u?







1 comments:

  1. LuckyClub Casino site - Lucky Club
    Our team of game luckyclub specialists makes sure that all our slot games are made with software that's more than capable of giving you the What Are The Best Slot Machine Games?How Many Slot Machines Can I Play For Free?

    ReplyDelete