Passing an array to a user function

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
altoclef
Posts: 30
Joined: 12 Oct 2012 18:54

Passing an array to a user function

Post by altoclef »

Code: Select all

    $a = array("cat", "dog"); 
    echo count($a); 
    Test($a);

Code: Select all

function Test(&$array){
    echo count($array); 
}
The twocount()statements show 2 and -1.

This happens whether I pass the array by value or by reference.

What is wrong with my code, please?

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Passing an array to a user function

Post by admin »

Nothing wrong with your code. :tup: That was my bug. :bug:

Fixed in next beta.

altoclef
Posts: 30
Joined: 12 Oct 2012 18:54

Re: Passing an array to a user function

Post by altoclef »

I've tested this in v23.80 and confirm that it is fixed.

Thank you.

Post Reply