- var_dump: documentation ( source)
<?php
function test(...$set) {
if (count($set) === 0) {
throw new \ArgumentCountError('can throw');
}
var_dump(count($set));
}
try {
test(1);
test(1, 2);
test();
} catch (\ArgumentCountError $e) {
echo $e;
}