DWPD-2.3: Write a PHP script to get type of variable using gettype() and settype().

gettype and settype in php example, get type of variable
Lab # 2

Basics of PHP

3. Write a PHP script to get type of variable using gettype() and settype().

Lab-2-3-gettype-settype.php

<?php
$a=10.5;
echo gettype($a);

settype($a,"int");
echo "<br>".gettype($a);
?>


Please try to yourself with other examples…

Output

gettype() and settype() example in php output
settype() and gettype() in php | by Practical Server

Happy Coding 🙂

Leave a comment