PHP 4

[ PHP ]

(!!! Teleportom!!!)
: fopen, msql_num_fields, socket_write ...


9.

PHP. PHP . ", ".

. "$a = 5", '5' $a. '5', , 5 , , '5' 5 ( '5' /integer ).

, $a 5, , $b = $a, , , $b = 5. , $a 5. , .

. , :

function foo ()
{
    return 5;
}

, "" ( , ), , $c = foo() , $c = 5, - . , return-. foo() /return 5, 'foo()' 5. , - .

, PHP . PHP : integer/, /floating point /string ( , '' , , , ). PHP () : . .

, PHP/FI 2 - . PHP , . PHP , , . : '$a = 5'. , , '5' $a, 5. : . , - 5. , '$a = 5', , , 5. , - '$b = ($a = 5)', '$a = 5; $b = 5;' (; ). , '$b = $a = 5'.

- - - . PHP/FI 2 ++ --. . PHP/FI 2 '$a++' ( ), , , . PHP increment/decrement, , C. PHP, C, : pre-increment post-increment. pre-increment, post-increment 1, . . Pre-increment, '++$variable', (PHP , , 'pre-increment'). Post-increment, '$variable++', $variable, (PHP , 'post-increment').

- . 0 1, FALSE TRUE (). PHP > (), >= ( ), == (), != ( ), < () <= ( ). , if.

, , -. , , $a 1, '$a++' '++$a'. , , 1, , 3? , , '$a++' , , , . '$a = $a + 3'. '$a + 3' $a 3, $a, $a 3. PHP, C, , . 3 $a , '$a += 3'. " $a, 3 $a". , , . '$a += 3', , . , 3, $a 3. -, , '$a -= 5' ( 5 $a), '$b *= 7' ( $b 7), etc.

, , , :

$first ? $second : $third

TRUE ( ), , . , .

pre- post-increment :

function double($i)
{
    return $i*2;
}
$b = $a = 5;        /*   5  $a  $b */
$c = $a++;          /* post-increment,    $a 
                       (5)  $c */
$e = $d = ++$b;     /* pre-increment,   
                       $b (6)  $d  $e */

/*    $d  $e  6  */

$f = double($d++);  /*    $d 
                       , 2*6 = 12,  $f */
$g = double(++$e);  /*    $e 
                       , 2*7 = 14,  $g */
$h = $g += 10;      /*  $g   10   
                        24.   (24) 
                         $h,  $h  
                        -  24 . */

, , , , , . . 'expr' ';'  - " ". '$b=$a=5;', $a=5 , . '$b=$a=5;', , .

, , . ( ) , , TRUE FALSE. TRUE FALSE ( ) . , boolean. . .

PHP , . , .

expr PHP-.


HTML

: 3119 .

: - |  -