It is used to convert one data type to another data type Except Array and Object . php $a = 10; $b = (string)$a; var_dump($b); echo '
'; var_dump($a); ?>
It is used to get the data type Var_dump() is used to get datatype,length and value but it return only datatype php $a = 5; $b = gettype($a); echo $b; ?>
Example for settype()
1)It is used to set the data type to a variable 2) if it is set successful then it returns true (1) else it return false (null) php $a = 5; $b = settype($a,'string'); var_dump($b); echo gettype($a); ?>
Example for isset()
If variable is existed it returns true(1) else it return false (null) php $a = 10; $b = isset($a); var_dump($b); ?>
Example for empty()
If variable is empty the it will return true (1) else it return false (null) php $a = 0; $b = empty($a); var_dump($b); ?>
== Equals to === Identical ( It will check value and data type ) != Not equals to !== Not identical > Greater then < Less then >= Greater then or Equals to <= Less then or Equals to
++ incrementation -- Decrementation Ex : $a = 10 ; $a++; similar to ( $a + = 1) that is $a = $a + 1 $a-- ; similar to ( $a - = 1) that is $a = $a - 1 $a = 10 ; Post increment echo ($a++) ; - 10; echo ($a) ; - 11; Pre increment echo (++$a) ; - 11; echo ($a) ; - 11; Note : Unari Operator takes one Value or variable . ( ! , ++ , -- ) Binary Operator takes two Values or variables . Bitwise Operator And & Or | Xor ^
Example1
php $a = 12; $b = 9; echo $a & $b; ?> Output : 8
Note :
binary value - 1100
binary value - 1001
12 & 9 - 1000 -> decimal value 8 ( 1*23 + 0*22 + 0*21 + 0*20 ) T & T = T T | T = T T ^ T = F (both are same F) T & F = F T | F = T T ^ F = T (both are diffarent T) F & T = F F | T = T F ^ T = T F & F = F F | F = F F ^ F = F -------------------------------------------------------------------- Example2 php $a = 12; $b = 9; echo $a | $b; ?> Output : 13 -------------------------------------------------------------------- Example3 php $a = 12; $b = 9; echo $a ^ $b; ?> Output : 5 --------------------------------------------------------------------