Code of the rounding function in php (floor function, ceil function, round and intval), ceilintval. The rounding function code (floor function, ceil function, round and intval) in php can be used together with ceilintvalfloor function and ceil
Code of the rounding function in php (floor function, ceil function, round and intval), ceilintval
The combination of the floor function and the ceil function makes the data processed by php more authentic and reliable.
I. First, let's look at the
No matter what type of data is, a number is returned. if it is not a number, 0 is returned. when $ _ GET [id] is used in PHP, a conversion can be done like this... great.
PHP code$ Id = intval ($ _ GET ['id']);
Intval(PHP 4, PHP 5)
Intval-Get the
PHPCode $ Id = intval ($ _ Get ['id']);
Intval (PHP 4, PHP 5)
Intval-get the integer value of a Variable
Description
Int intval (mixed $ var [, int $ base = 10])
Returns the integer value of VaR, using the specified base for the conversion
1, Intval & (int) can not be converted to Object.
2, conversion efficiency (int) > Intval () > sprintf (Intval is the built-in method of PHP, relatively low efficiency).
3, the other exactly the same.
4, input 0123, the 0x123 (int) function will
As early as a few years before SQL injection went viral, string conversion into integers has been listed as a required operation for every web program. The web program forcibly converts the id and integer equivalent values from get or post into
Background, overviewAs early as the SQL injection rampage, the string converted to integers has been listed as a prerequisite for every Web application. The Web program converts the ID, integer equivalent of Get or post to an integer, filters out
This article first introduced the PHP intval simple usage, it can convert characters, numbers, decimals conversion gray digital data, but in the conversion will appear some problems such as decimal 1.1 will be converted to 1, see the example
As early as a few years before SQL injection went viral, string conversion into integers has been listed as a required operation for every web program. The web program forcibly converts the id and integer equivalent values from get or post into
We learn
First, PHP intval function description
The Intval function has a feature: "Until a number or sign is encountered to start the conversion, and then the non-numeric or end of the string () end Conversion", in some applications due to the
This article first introduces the simple usage of php intval, which can convert characters, numbers, and decimals into gray-numeric data. However, some problems may occur during conversion, such as converting decimal 1.1 to 1, see the instance below.
Parse unexpected exceptions in int conversions such as intval () in PHP. Let's take a look at the following online test code: Copy the code as follows :? Php $ a9.45 * 100; var_dump ($ a); var_dump (intval ($ a); $ a945 * 1.00; var_dump ($ a);
We learn
1. PHP intval Function Description
The intval function has a feature: "conversion starts only when a number or positive or negative sign is encountered, and the conversion ends when a non-number or string ends ", in some applications, due
Background and overviewAs early as a few years before SQL injection went viral, String Conversion into integers has been listed as a required operation for every web program. The web program forcibly converts the id and integer equivalent values
$ Line [1] intval ($ line [1]); what does this write mean?
Bob's Auto Parts - Customer OrdersBob's Auto PartsCustomer Orders
No orders pending. Please try again later."; } echo "
\n"; echo "
Order Date
Variable to an integer type.
Syntax: int intval (mixed var, int [base]);
return value: Integer
Function type: PHP system function
Content Description
This function converts a variable to an integer type. The parameter base that can be omitted
Bob ' s Auto parts-customer OrdersBob ' s Auto PartsCustomer Orders
No orders pending. Please try again later."; } echo "
\ n "; echo "
Order Date
Tires
Oil
Spark Plugs
Total
Address
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.