Definition and Usage:
Gets the integer value of the variable, allowing it to be returned using a specific system. Default 10 system
Note: If the argument is an integer, no processing is done.
Grammar:
Intval (Var, base)
Parameter list:
Parameters |
Description |
Var |
Have to. Can be any scalar type. Intval () cannot be used in arrays or objects (classes). I have to mention here. Scalar types contain four kinds: Boolean (Boolean) integer (integer) float (floating-point type, also called Double) string (string) |
Base |
Optional. Transform the system used, default 10 if base is 0, determine the use of the system by detecting the format of the Var argument: If the string includes a prefix of "0x" (or "0X"), use 16 if the string starts with "0" and uses 8 to other uses 10 |
For example:
Echo intval ("0x1a", 0), "\ n"; Use the 16-in system. Results "Intval"
Echo ("057", 0), "\ n";//using 8. Results "10"
Echo intval ("a"), "\ n"; Results
Echo intval ("0"), "\ n";