PHP Basics Overview _php Tutorial

Source: Internet
Author: User
Tags float number php basics
PHP basic knowledge The number of shapes in PHP is signed and cannot represent unsigned integers, and when the number of shapes is out of range, it is automatically converted from the shaping number to float number, you can use the Php_int_size constant to see the php integer type of bytes, generally 4 bytes, So we can estimate the range of the shaping number, the highest digit sign bit. You can also use the Php_int_max constant to view the maximum value of an int. Small knowledge point: 1. When a variable of 0.0 or "0" in a Boolean variable represents false; 2. A string variable with double quotation marks when the variable and escape character can be normal output according to its definition, while the single quote output content when it will output its content, that is, the escape character or variable will not work, and will only output literal content, this can write the code to see the difference. Personally feel PHP variable definition is a bit like JS, because you do not need to specify any of its types, its type depends entirely on the actual type you use. 3. The arithmetic operator for PHP: NOTE: Division sign "/" can result in an integer or float. Instead of just integers, for example 5/2 results are 2.5, and in c the result is 2. When the results are not endless, the results show 14 significant digits. Operators have a total of + 、-、 *,/, and% five operators. The symbol that links two strings is not a + sign in Java, but instead. Point number, the dot will automatically treat the variable as a string. the "= =" symbol differs from "= =": the "= =" symbol indicates that only the left and right values are equal to be true. the "= = =" symbol indicates that both the left and right values are equal, and even variable types should be equal to return true. The following example: $a = 2; $b = 2.0; The values of $ A and $b variables in the above example are equal, but the types are not equal! all use = = is true, with = = = False. $a!== $b indicates that the result is true whenever a and B values are unequal or if the type is unequal. $a! = $b indicates that the result is true only if the values of a and B are not equal. $a <> $b represents the same meaning as $a! = $b. echo $a = = The content of the $b output is not true or false. Instead, 0 and 1, and 1 for true,0, represents false. There are also >=, <= symbols that are greater than or equal to, less than or equal to. Logical judgment has a special, when the previous judgment is true, "| |" The expression after the symbol is not executed, so be careful! The same is also the case with the && symbol. This phenomenon is called a short circuit. Short-circuit and short-circuit or is the representative thereof. | Symbols can be substituted with or. The same && symbol can be substituted with and. But there's a difference between the English or the And and the and: OThe r operator is lower than = low. For example $a = False | | True A returns true; $a = False or true; = "($a = false) or true; Var-dump ($a, $b); The same is also the case with the same and symbol. Type operator: instanceof, used to determine if the data is a class of instances, similar to Java, the result returns TRUE or FALSE. The + + and-operators are only for variables and cannot be used on constants! The switch statement in PHP can be a Boolean type in parentheses! The string "0" is considered false. The default statement can be placed anywhere without affecting the order in which other case statements are executed! Even if the first sentence in the switch statement is placed. But be careful to remember to write the break statement. Form submission problem: In Firefox, the form submitted by the method of POST, the corresponding method of obtaining a field is $_post, rather than $_request, and in IE or Firefox, whether it is a post or get can be used $_request to obtain content. The $_request parameter corresponds to the Name property value of the form's corresponding INPUT element. Break statement differences in PHP: First you have to understand what a loop is? A loop is a part of a for and while keyword that is called a loop, which is different from the curly brace of the IF statement, which is typically used in an if statement to skip this loop of the for loop or the current loop of the while loop. Continue Do not assume that the curly braces in the For loop represent a loop, and the curly braces under the If statement are not loops. A break statement can be followed by a number indicating that it jumps out of the first layer of the loop, with the curly brace area in which the break statement is used. Sliding scale outward, instead of ascending from outside. But notice that the numbers are too big to go beyond the outermost loop! For example, there are only 3 layers of loops, you have to jump 4 layers, this will be wrong! The break default out-of-loop layer is 1. The continue statement is used to end the loop, skipping the rest of the loop to start a new loop. The goto statement is valid for Goto only in php5.3 or above: The break statement used to jump out of a loop instead of a multiple loop. Make the code more concise! The difference between variables and constants in PHP: 1. There is no dollar sign in front of constants. 2. Constants are defined by the Define () function or const and cannot act as an lvalue to an assignment statement. 3. Constants can be used and accessed everywhere regardless of the scope of the variable. 4. Once a constant is defined, it cannot be redefined or de-defined. 5. The value of the constant is scalar "basicData type float, int, string, Boolean. Defines two forms of a constant: define ("Int_max", 255), or const int_max=255, which cannot be added to the dollar symbol before the constant, nor can it be re-assigned.

http://www.bkjia.com/PHPjc/532690.html www.bkjia.com true http://www.bkjia.com/PHPjc/532690.html techarticle PHP Basic knowledge of the number of shapes in PHP is signed, can not represent unsigned integers, when the number of shapes out of range, will automatically convert from the number of shaping to float number, you can use the Php_int_size constant ...

  • 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.