A brief analysis of using PHP logical operators _php Tutorial

Source: Internet
Author: User
Tags microsoft iis
PHP is still more commonly used, so I studied the PHP logical operators, here to share with you, I hope to be useful to everyone. PHP is a powerful server-side scripting language for creating dynamic, interactive sites.

PHP is free and very widely used. At the same time, for competitors such as Microsoft ASP, PHP is undoubtedly another high-efficiency option. PHP is great for web development, and its code can embed HTML code directly. PHP syntax is very similar to Perl and C. PHP is often used in conjunction with Apache (Web server). However, it also supports ISAPI and can run on Windows's Microsoft IIS platform. The string operator, which has two string operators. The first one is the join operator (".") ), which returns the string after its left and right arguments are concatenated. The second is the Join assignment operator (". ="), which attaches the right argument to the left argument.

1. String operators

Example:

 
  
  
  1. Php
  2. $ a = "Hello" ;
  3. $ b = $a. " world! ";
  4. $ a = "Hello" ;
  5. $ A. = "world!" ;
  6. ?>

The only one array operator in PHP is the + operator. It appends the right array to the left array, but the duplicate key values are not overwritten.

 
  
  
  1. $ a = Array ("A" =>"Apple", "b" =>"banana");
  2. $ b = Array ("A" =>"pear", "b" =>"Strawberry", "c" => "Cherry");
  3. $ C = $a + $b;

Once executed, this script will display:

 
  
  
  1. Array (3) {
  2. ["A"]= >
  3. String (5) "Apple"
  4. ["B"]= >
  5. String (6) "Banana"
  6. ["C"]= >
  7. String (6) "Cherry"

2.PHP logical operators :

PHP logical operators:
$aand $band (logical AND) true if $ A and $b are both true.
$aor $bor (logical OR) True if either $ A or $b is true.
$axor $bxor (Logical XOR) True if either $ A or $b is true, but not both.
! $aNot (logical non) True if $ A is not true.
$a && $bAnd (logical AND) true if $ A and $b are true.
$a | | $bOr (logical OR) True if either $ A or $b is true.

There are two different form operators for "and" and "or" because their operations have different precedence.


http://www.bkjia.com/PHPjc/446483.html www.bkjia.com true http://www.bkjia.com/PHPjc/446483.html techarticle PHP is still more commonly used, so I studied the PHP logical operators, here to share with you, I hope to be useful to everyone. PHP is a powerful way to create dynamic interactive sites ...

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