- array_slice: documentation ( source)
<?php
function foo(&$obj) {
return $obj;
}
$o = new StdClass;
// No errors
foo($o);
call_user_func('foo', $o);
call_user_func('foo', [$o]);
$a[] = $o;
$a[] = $o;
$a[] = $o;
// Warning: Parameter 1 to foo() expected to be a reference, value given in
call_user_func('foo', array_slice($a, 0, 1));