(int) / intval() / floatval()
Try it yourself →Converts text/value to a number.
Syntax
(int)$value · intval($value)
Description
(int) or intval converts to integer, floatval to float.
Example
<?php
echo (int)"42" + 8;
echo "\n";
echo floatval("3.5") * 2;Expected output
50 7
When to use?
Accounting for form/input text.