#39340 [NEW]: "With" keyword

From: Date: Thu, 02 Nov 2006 02:34:22 +0000
Subject: #39340 [NEW]: "With" keyword
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104267@lists.php.net to get a copy of this message
From:             thehub at lofty dot net dot au
Operating system: Windows XP
PHP version:      4.4.4
PHP Bug Type:     Feature/Change Request
Bug description:  "With" keyword

Description:
------------
Visual Basic has a neat little code trick that I'd like to see in PHP...
With object1
    .property1="value"
    .function1()
End With
And it can be nested. This is useful if you don't want to create a
variable to hold the return of, e.g. a function call that returns an
array, when you only need it for two or three lines.

Reproduce code:
---------------
with($nested_array['a_very_long_key']){
    $[0]='apples';
    with(function1($[1]->data))
        echo template($['title'],$['content']);
}

// or

with $object1:
    with $->property1:
        function1($['key_of_property1']);
    endwith
endwith


-- 
Edit bug report at http://bugs.php.net/?id=39340&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39340&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39340&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39340&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39340&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=39340&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39340&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39340&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39340&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39340&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39340&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=39340&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=39340&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39340&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39340&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39340&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39340&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39340&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39340&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39340&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39340&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#104267) next »