PHP 9: Expressions

Source: Internet
Author: User
Tags php website
This chapter describes the expressions for PHP.
The expression in PHP is no different from other languages. An ordinary assignment is an expression, a function is an expression, and a function is assigned a value. The ternary conditional operator is also, that is:

$first? $second: $third

There are many languages, no more speaking.
Finally, let's take an example from the PHP website:

1 2 function double ($i)
3 {
4 return $i * 2;
6 $b = $a = 5; /* Assign the value five into the variable $a and $b */
7 $c = $a + +; /* Post-increment, assign original value of $a
8 (5) to $c */
9 $e = $d = + + $b; /* Pre-increment, assign the incremented value of
$b (6) to $d and $e */
*/* At the point, both $d and $e is equal to 6 */
$f = Double ($d + +); /* Assign twice the value of $d before
The increment, 2*6 = $f */
$g = double (+ + $e); /* Assign twice the value of $e after
Increment, 2*7 = $g */
$h = $g + = 10; /* First, $G is incremented by and ends with the
Value of 24. The value of the assignment () is
Assigned to $h, and $h ends with the value
as well. */

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