4 ms·
No, you can't. You may be thinking of call_user_func_array, but once again you can indexed array. The most you can do -- which is what I am doing now -- is use
by EGreg 16y ago
No, you can't. You may be thinking of call_user_func_array, but once again you can indexed array.
The most you can do -- which is what I am doing now -- is use the design pattern:
function stuff($required1, $required2, $options = array())
{
}
This pattern works really well, and makes the function interface endlessly extensible. If we implemented named parameters in PHP, it would turn every EXISTING function into such a pattern, which would make functions evolve nicely instead of becoming monstrosities with default parameters in an arbitrary order:
stuff(1, 2, null, true, null, 0, array(), '<br>')