RE: [PHP] comparable Perl "unless" in PHP?
| From: | Sander Pilon | Date: | Fri, 03 Nov 2000 15:45:59 +0000 |
| Subject: | RE: [PHP] comparable Perl "unless" in PHP? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23586@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.
<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
>