My Life with PHP

compound Datatypes:

  1. Array: collect of elements.
  2. object: instance of a class.

Special Datatypes:

Resource Datatypes:


It referrs the external Resources like Database conn?, FTP conn?, file ptrs etc.

$con=Mysql-connect("local host","root"," ");
echo $con."
";echo get-resource-type($con);?>
Saye As:

Resource Datatype.php


Resource id #2 Mysql link

Null Datatype:

In php,null is not a value we can consider a variable as Null variable based on 3 cond?

  1. If the variable is not seb with any value.
  2. If the variable is set with null value.
  3. If the value of variable is unset.
Is null:

By using this f?,we can check whether the variable is null or not.

echo is-null($x);


We can unset the variable value by using unset f?

Saye as: isnull.php

Array is collection of heterogeneous (dissimilar) datatypes. php is loosily typed long.
That's why we can store any type of values in arrays.

normal variable can store singil value, Arroy can store multiple values.

Arroy cantains no. of eliments, Each eliment is a combinat of eliment key of element value.

The key of 1 st element is '0' and last elemeny is total elements-1.

Static Variable:

static variables can maintain the previous values. we can assign the values only one time into static variable.



<?php function fun1() { static $x=100; $x++; echo $x; } fun1(); fun1(); fun1(); ?>

o/p: 101,102,103
if we don't write static here,then the o/p will be 101,102,103.


Reference Variables:

It refers the value of another variable. Actual Variable and Reference variables refers the value of same address location.



<?php $x=100; $y=&$x; $y=200; echo $x; ?>



Super Global variables:

Php is Providing no. of super Global Variables We can access this Super global Variables from any location(from any web page) within the project. Different types of super Global variables are available. These are $_Get,$_Post,$_Request,_Server,$_Session,$_Cookies, $_Files,$ENY.

All Super Global Variables are array datatype.