note 10775 deleted from language.operators.logical by colder

From: Date: Fri, 20 Apr 2007 15:38:12 +0000
Subject: note 10775 deleted from language.operators.logical by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125693@lists.php.net to get a copy of this message
Note Submitter: muerte at web-ster dot com ---- I was hoping to find an operator similar to ||= functions in perl. My first thought would be: $i = $i or "default" But or doesn't work like that. If you want to assign a default value to your variables only if they're not already assigned you CAN however do: $i or $i = "default" The first example does NOT work because the or operator is not overloadable like it is in Perl.

« previous php.notes (#125693) next »