- var_dump: documentation ( source)
- filter_var: documentation ( source)
<?php
function f($data) {
var_dump($data);
var_dump(filter_var($data, FILTER_VALIDATE_INT));
echo PHP_EOL;
}
f(null);
f(false);
f(0);
f("0");
f(1);
f("1");
f(array());
f(array(0));
f(array(1));
class ToStringAble {
function __toString() {
return "0";
}
}
f(new ToStringAble());
f(new stdclass());