Re: Assignment operator proposal
| From: | Enrico Weigelt | Date: | Wed, 20 Mar 2002 22:48:53 +0000 |
| Subject: | Re: Assignment operator proposal | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89427@lists.php.net to get a copy of this message | ||
On Thu, Mar 21, 2002 at 12:36:26AM +0200, Bogdan Stancescu wrote:
> Hi all!
>
> I'd like to hear from a single one of you who isn't tired of code similar to
i'm solving this with some little knowledge of shortcuts evaluation ...
> <?
> if (!$whatever) {
> $whatever=something;
> }
> ?>
(($whatever) || ($whatever = something));
> or else
>
> <?
> if ($whatever)
> {
> $somethingelse=$whatever;
> }
> ?>
(($whatever) && ($somethingelse=$whatever));
> How about a new asignment operator which would shut up all those Python
> enthusiasts - let's say the new operator would be caret - and we could
> replace the first example with
sounds interesting.
IMHO you have to rewrite some stuff in the php language parser
so it detects these expressions and generates an if-else-tree ...
~-n
--
Enrico Weigelt == meTUX IT services
software development, IT service, internet security solutions
www: http://www.metux.de/ phone: +49 36207 519931
email: contact@metux.de cellphone: +49 174 7066481