Re: PROPOSAL: 'unless' control structure

From: Date: Sun, 12 Jan 2003 19:29:34 +0000
Subject: Re: PROPOSAL: 'unless' control structure
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-93383@lists.php.net to get a copy of this message
On Sun, 2003-01-12 at 20:47, Sara Golemon wrote: [...] > This has been discussed (recently in fact) and won't be done. However, > you *can* give your code the type of readability you're looking for with: > > ($condition) || { > /* This will only run if $condition evals to false */ > } Nope, that gives me a parse error: thekid@friebes:~ > echo '<? function unless($c) { return $c; } $c= FALSE; unless($c) || print("!condition\n"); ?>' | php -q !condition thekid@friebes:~ > echo '<? function unless($c) { return $c; } $c= FALSE; unless($c) || { print("!condition\n"); } ?>' | php -q Parse error: parse error in - on line 1 It'll work for exactly one statement (e.g. mysql_connect() or die()), but not with blocks (mysql_connect() or { mail(...); die(); })). -- Timm Friebe <thekid@thekid.de>

« previous php.dev (#93383) next »