← All built-ins / intval()
intval()
intval(mixed $number): int
Parameters
| Name | Type | Description |
|---|---|---|
| $v | mixed | value to convert |
Return value
The integer value: floats truncate, strings parse their leading number (0 when not numeric).
Example
echo intval("42"), " ", intval(3.99), " ", intval("12abc"), " ", intval(true);42 3 12 1