I've tested the following and it works on both PHP 5.2 and 5.3, however, it's not documented anywhere as far as I can see so I'm evaluating its use.
I have a function in a class called isValid, this checks a hash to see if the given value is in the set of allowed values. There are some values that are valid, but deprecated; I'd like my isValid function to update the passed in value to the current one and return true.
That's fine for when I call it myself, however, I'd like to use this method when used as a callback for array_filter too.
Here's a test case, which as expected results in an array with the values 2,3,4,5,6.
<?php
$test = array(1, 2, 3, 4, 5);
echo print_r(array_filter($test, 'maptest'), true);
function maptest(&$value)
{
$value ++;
return true;
}
So StackOverflow: is this allowed, or is it undocumented functionality that may disappear/stop working/cause errors in the future?