Professional Web Applications Themes

#39340 [NEW]: "With" keyword - PHP Bugs

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 ...

  1. #1

    Default #39340 [NEW]: "With" keyword

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

  2. #2

    Default #39340 [Opn]: "With" keyword

    ID: 39340
    User updated by: thehub at lofty dot net dot au
    Reported By: thehub at lofty dot net dot au
    Status: Open
    Bug Type: Feature/Change Request
    Operating System: Windows XP
    PHP Version: 4.4.4
    New Comment:

    or perhaps for a long piece of code that would be used a lot. this ugly
    rectangle of code for example:

    $server[$currServ][$currDB][$currGroup][$currUser]['access']=4;
    $server[$currServ][$currDB][$currGroup][$currUser]['email']='';
    $server[$currServ][$currDB][$currGroup][$currUser]['lastlogin']=0;
    $server[$currServ][$currDB][$currGroup][$currUser]['projects']=array();

    becomes

    with($server[$currServ][$currDB][$currGroup][$currUser]){
    $['access']=4;
    $['email']='';
    $['lastlogin']=0;
    $['projects']=array()
    }

    kind of like a function that's created on the fly and then destroyed
    when it's finished


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-11-02 02:34:22] thehub at lofty dot net dot au

    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 this bug report at [url]http://bugs.php.net/?id=39340&edit=1[/url]
    thehub at lofty dot net dot au Guest

Similar Threads

  1. CFINPUT type="radio" w/ "value" requires "label"
    By Iceborer in forum Macromedia ColdFusion
    Replies: 2
    Last Post: February 21st, 06:16 PM
  2. "const" keyword in PHP4? What does it do?
    By Joshua Beall in forum PHP Development
    Replies: 0
    Last Post: August 25th, 03:44 PM
  3. What is the keyword for "pause" ?
    By chilander webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 6th, 07:04 PM
  4. Replies: 14
    Last Post: December 15th, 02:14 AM
  5. Alternative to the keyword "the"??
    By hanct2002 webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 2
    Last Post: August 11th, 02:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139