TAILIEUCHUNG - PHP and MySQL Web Development - P14

PHP and MySQL Web Development - P14: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 32 Chapter 1 PHP Crash Course Comparison Operators The comparison operators are used to compare two values. Expressions using these operators return either of the logical values true or false depending on the result of the comparison. The Equals Operator The equals comparison operator two equal signs enables you to test if two values are equal. For example we might use the expression a b to test if the values stored in a and b are the result returned by this expression will be true if they are equal or false if they are not. It is easy to confuse this with the assignment will work without giving an error but generally will not give you the result you wanted. In general non-zero values evaluate to true and zero values to false. Say that you have initialized two variables as follows a 5 b 7 If you then test a b the result will be The value of a b is the value assigned to the left-hand side which in this case is is a non-zero value so the expression evaluates to true. If you intended to test a b which evaluates to false you have introduced a logic error in your code that can be extremely difficult to find. Always check your use of these two operators and check that you have used the one you intended to use. This is an easy mistake to make and you will probably make it many times in your programming career. Other Comparison Operators PHP also supports a number of other comparison operators. A summary of all the comparison operators is shown in Table . One to note is the new identical operator introduced in PHP 4 which returns true only if the two operands are both equal and of the same type. Table PHP s Comparison Operators Operator Name equals identical not equal not equal less than Use a b a b a b a b a b Operators 33 Table Continued Operator Name Use greater than a b less than or equal to a b greater than or equal to a b Logical Operators The logical operators are used to combine the results of logical conditions. .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
8    164    3    23-12-2024
11    163    2    23-12-2024
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.