PROPOSAL: "unless" control structure

From: Date: Sun, 12 Jan 2003 18:53:12 +0000
Subject: PROPOSAL: "unless" control structure
Groups: php.dev 
Request: Send a blank email to php-dev+get-93379@lists.php.net to get a copy of this message
My apologies if this has been brought up before, but I searched the archives and couldn't find a reference to it. I'm sure this is the sort of thing that would have already been implemented if there was any desire for it among the developers, but I was wondering if anyone had considered adding support for an "unless" control structure, similar to the one Perl has. I personally find it much more logical in certain cases. For example, compare this: if (!$user->isAdministrator) { header('Location: ...'); exit; } With this: unless ($user->isAdministrator) { header('Location: ...'); exit; } I think the second one is much easier to read. I strive to write code that is self-documenting, so I tend to pick variable names and function names that are pretty self explanatory. I think an "unless" control structure would go a long way to helping people write self-documenting code. Just a thought, sorry if this is not the proper forum for this sort of thing.

« previous php.dev (#93379) next »