- var_dump: documentation ( source)
<?php
function accept_array($a) : void
{
var_dump($a);
unset($a);
}
function return_array()
{
return new class implements ArrayAccess {
public function offsetExists(mixed $offset): bool { return true; }
public function offsetGet(mixed $offset): mixed { return 42; }
public function offsetSet(mixed $offset, mixed $value): void {}
public function offsetUnset(mixed $offset): void {}
};
}
$input = return_array();
if (isset($input['key'])) {
accept_array($input);
}