时间:2021-07-01 10:21:17 帮助过:2人阅读
$first ? $second : $third
1 php
2 function double ( $i )
3 {
4 return $i * 2 ;
5 }
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
10 $b (6) to $d and $e */
11
12 /* at this point, both $d and $e are equal to 6 */
13
14 $f = double ( $d ++ ); /* assign twice the value of $d before
15 the increment, 2*6 = 12 to $f */
16 $g = double ( ++ $e ); /* assign twice the value of $e after
17 the increment, 2*7 = 14 to $g */
18 $h = $g += 10 ; /* first, $g is incremented by 10 and ends with the
19 value of 24. the value of the assignment (24) is
20 then assigned into $h, and $h ends with the value
21 of 24 as well. */
22 ?>