|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-16 22:14 UTC] kalle@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: kalle
[2010-08-16 22:14 UTC] kalle@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 23:00:01 2025 UTC |
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