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
    nst
    nst is offline
    New Coder
    Join Date
    Jul 2005
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    global array declaration

    I have an array $delete_entry[]

    I want to take some values from a function and use them in another function.
    The variables inside the new function would be of the type
    $delete_entry[$id]

    I am using globals in order to do this like
    global $id;
    etc.

    What's the appropriate global declaration for the array?
    Last edited by nst; 06-14-2006 at 02:16 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'd declare it just like any other variable:

    PHP Code:
    function foo()
    {
      global 
    $x;

      
    $x = array('bar' => '5','blah' => '6');
    }

    foo();
    print_r($x); 


  •  

    Posting Permissions

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