Re: comparable Perl "unless" in PHP?

From: Date: Thu, 02 Nov 2000 18:15:44 +0000
Subject: Re: comparable Perl "unless" in PHP?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23615@lists.php.net to get a copy of this message
> Tssk tssk tssk.. bad coding :) > > !x==y reads pretty bad. > > It could read !(x==y) or (!x)==y, it'd never pass any respectable coding > standard. > > As for perl, I never understood why there is an unless statement. Perhaps it > makes interprenting it somewhat faster. (one for unless(x) vs two statements > for if(!x)) > Also, the one-line thingies in perl are pretty neat. you could use the ternary operator, but is looks extermly ugly (imo) <? $x = ($x < 10) ? $x + 10 : $x; ?> daniel > <statement> unless <expression>; > > ex: > > $x = $y + 10 unless ($x > 10); > > Cheers, > > -Sander > > > > > Brian > > > > I don't know Perl, but it looks to me like unless does the same as > > if(!expression), > > hence > > > > if(!$UserId==$MyUserId) > > { > > do something > > } > > > > is effectively saying > > unless($UserId==$MyUserId) > > { > > do something > > } > > > > Of course, I could just be missing the point because I don't really know > > what unless does in Perl :-) > > > > Cheers > > -- > > Phil Driscoll > > Dial Solutions > > +44 (0)113 294 5112 > > http://www.dialsolutions.com > > http://www.dtonline.org > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > /*-- daniel beulshausen - daniel@php4win.de using php on windows? http://www.php4win.de

« previous php.general (#23615) next »