From: Operating system: Irrelevant PHP version: Irrelevant Package: Scripting Engine problem Bug Type: Feature/Change Request Bug description:{} with Return Value
Description: ------------ It would be pretty cool if you were able to use { CodeHere; } as Statement. The Basic Idea behind this is like if the Code was a Function that had a Return Statement. Its only a little inefficient because the Function might only be used one Time, which means it would be useful to have such a Feature. Examples are given in the TestScript Test script: --------------- <?php //1. if({ $a = false; $b = true; return (time() % 2) && $b || $a; }) echo 'It equals to True'; //2. mysql_connect(...) or { $file = fopen('ErrorLog', 'a+'); ...; return die(); }; //3. $a = 12 + { return 2 * 2; }; ?> Expected result: ---------------- 1. Depending on the Time echoing 'It equals to True'; 2. When mysql_connect returns false that it evaluates the {}-Code 3. $a = 16; Actual result: -------------- Parse Error of course -- Edit bug report at http://bugs.php.net/bug.php?id=52432&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52432&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52432&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52432&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52432&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52432&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52432&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52432&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52432&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52432&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52432&r=support Expected behavior: http://bugs.php.net/fix.php?id=52432&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52432&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52432&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52432&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52432&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52432&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52432&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52432&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52432&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52432&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52432&r=mysqlcfg