PHP intval () function ____ function

Source: Internet
Author: User
Tags scalar

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";  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.