Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts

    Something I've never understood ....

    Is why you can't, for example, use some pass-by-value functions inside each other.

    For example, you can't have:

    PHP Code:
    empty(array_diff($ar1$ar2)); 
    without getting a write-context error.

    Instead you must use:

    PHP Code:
    $diff array_diff($ar1$ar2);
    empty(
    $diff); 
    Why?? None of the arguments to empty are references so I don't see what the Zend engine has to complain about!

    It's just something that has bugged me ever since I first came across it ...

    I notice this happens in a number of other cases when the argument that is being complained about is not being passed by reference.
    Last edited by mlse; 07-10-2009 at 03:07 PM.
    Die Welt ist ein Irrenhaus und hier ist die Zentrale!

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    I think it's because empty() is a language construct, not a function. I don't really know why that limits it though...


  •  

    Posting Permissions

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