PHP Built In Functions
There are 4 types of php built in functions
1. Var_dump(var_name) built in function : Is a built-in function of php used for getting the type of variable with
content of variable.’
<?php
$x=10;
Var_dump($x);
Echo
“<br>”;
$x=10.65;
Var_dump($x);
Echo
“<br>”;
$x=”India” ;
Var_dump($x);
Echo
“<br>”;
$x =true;
Var_dump($x);
Echo
“<br>”;
?>
2. Gettype(var_name) built in function : is a built-in function of php used for
getting the type of variable.
3. Settype(var_name
, New type) built in function : is a built-in function of php used for setting a new type to the
variable.
4. Unset(var_name) built in function : is a built-in function of php used for removing the content of variable.
<?php
$a=10;
$b=2.3;
$c=”peers”;
$d=true;
Echo
gettype($a).”—“.gettype($b).”—“.gettype($c).”—“.gettype($d).”<br>”;
$x=”A12A”;
Settype($x ,
“integer”);
Echo
$x.”—“.gettype($x).”<br>”;
$x=”india” ;
Echo
gettype($x).”<br>”;
Unset($x);
Echo getype($x);
?>
0 comments:
Post a Comment