Using settype() method you can set the type of variable.
Syntax
Bool settype(mixed $var, string type)
Parameter
|
Description
|
Var
|
The variable being converted.
|
Type
|
Possible values of type are Boolean, integer, float, array, object,
null.
|
Example
<?php
$var1=’98’;
$var2=’01’;
settype($var1, “integer”);
Settype($var2, “integer”);
echo ($var1.’<br>’);
echo ($var2.’<br>’);
echo ($var1+$var2.’<br>’);
?>
0 comments:
Post a Comment