This repository was archived by the owner on Feb 1, 2019. It is now read-only.
The safer() function now has an enforceDefaults option. If true then keys defined in the validation map are will be returned with defaults values in the associative array from calls to safer().
$a = safer([], [
'i' => 'integer',
'name' => 'text',
], false, true);
print('i is ' . $a['i'] . ' (zero) and name is "' . $a['name'] . '" (an empty string)' . PHP_EOL);
This would display something like
i is 0 (zero) and name is "" (an empty string)