1$num = "3.14";
2$int = (int)$num;//string to int
3$float = (float)$num;//string to float
1phpCopy<?php
2$variable = "53";
3$integer = intval($variable);
4echo "The variable $variable has converted to a number and its value is $integer.";
5echo "\n";
6
7$variable = "25.3";
8$float = floatval($variable);
9echo "The variable $variable has converted to a number and its value is $float.";
10?>
11