PHP Language Basics by acreaper_php tutorial

Source: Internet
Author: User
Actually write these PHP article is very basic, and jumped over a lot of grammar points, because C language and C + + science is better, a lot of similar, just write a different place, easy to learn. Sharing out is also convenient and i the same situation of people learning, if nothing has learned, do not understand the data structure, do not understand the algorithm, do not understand C, it is best not to read my writing, but because it should buy a better reference book to refer to. The definition of constants in 02.1PHP define ("Constant_name", Value[,case_senstivitty]); where "constant_name" is a constant, it is a string, value is the values (for any valid PHP expression, contains objects and arrays). And the last one is literally meaning to know its meaning is case-sensitive. The default is the distinguished value is true, and vice versa is false. constants, like C, are generally written in uppercase. The 02.2 operator PHP consists of three operators, unary, two, and ternary operators. The PHP type transformation principle is similar to C, which translates into a much more stored direction, with the following specific rules. The conversion direction. Cannot reverse, otherwise the data is lost! 1. Convert to the type that is most stored, that is, the largest range. 2. String-to-integer conversion, not enough to the real type. 3. Integer to Real type conversion and Boolean type, NULL type, resource type is similar to the integer type, in fact, can be understood as the essence is related to integers, as for the reason you see the kernel implementation code to know. Boolean:false = 0,true = 1 Null = 0; Resource = the Resource ' s # (ID) 02.2.1 Talk about the two-dollar operator first, the more special two-tuple operator in PHP is the concatenation operator (.) and the other is the same as the C language. Second, all mathematical operators only calculate numeric operators, and encounter other types of conversions as described earlier. The following is an introduction to the concatenation operator (.) concatenation operator that only makes concatenation of two strings, which means that the operator only processes strings, so any operand that is not a string is first converted to a string. This is like an overloaded operator in C + +, you first have to specify the type that the overloaded operator will operate on and cast. Eg: $year = 2013; Print "The year is". $year; The $year is converted internally to the string "2000" and then concatenated with the preceding string "The year is". The 02.2.2 reference assignment operator. $name = "Judy"; $name _alias = & $name; $name _alias = "Jonathan"; Print $name; The lossOut Jonathan. As a result, we can conclude that the so-called reference in PHP is the same as in C + +, in fact it is based on C pointers. It is quite the same as giving the variable another alias. When the value of a function is returned by reference, a reference symbol is required for the description. $retval = & Function_return_by_reference (); 02.3 comparison operator (==,===,!== only) = = Check that two operands are equal! , the rule is 1 = = "1" returns true,1 = = 1 also returns true if a type conversion is required. = = = Same as = =, but the type must be the same, do not perform automatic type conversion so 1 = = = "1" logical value is false!== and = = = Instead, the difference with! = is that the type must be the same, and no automatic type conversion is performed.

http://www.bkjia.com/PHPjc/477214.html www.bkjia.com true http://www.bkjia.com/PHPjc/477214.html techarticle actually write these PHP article is very basic, and jumped over a lot of grammar points, because C language and C + + science is better, a lot of similar, just write a different place, easy to learn. Points ...

  • Related Article

    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.