note 34075 deleted from language.operators by sniper

From: Date: Mon, 13 Oct 2003 00:06:21 +0000
Subject: note 34075 deleted from language.operators by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58371@lists.php.net to get a copy of this message
Note Submitter: abodeman at @ yahoo . com ---- Two operators that don't seem to be in the manual anywhere are the unary plus and the unary minus. The unary minus returns the opposite of its argument, and the unary plus appears to do nothing. These operators are apparently on the same level of precedence as !, ~, ++, --, the casts, and @. The following example may provide a better explanation than this paragraph did: $zero = 0; $three = 3; $four = 4; $neg_three = -3; $neg_four = -4; $a = -$three; // $a is -3 $b = -$neg_three; // $b is 3 $c = -$zero; // $c is 0 $d = +$three; // $d is 3 $e = +$neg_three; // $e is -3 $f = +$zero; // $f is 0 $g = -!$zero; // $g is -1 $h = !-$zero; // $h is 1 $i = -$d++; // $i is -3, $d is 4

« previous php.notes (#58371) next »