Lab # 2
Basics of PHP
4. Write a PHP script to set type of variable using type casting.
Lab-2-4-typecast.php
<?php
define("PI",3.14);
$r=5;
$ans=PI*$r*$r;
echo "Radius(in double)=$ans"."<br>";
settype($ans,"int");
echo "Radius(in integer)=$ans";
?>
Output
![]() |
| Type Casting in php | by Practical Server |
Happy Coding :)


0 Comments
Post a Comment