Q:

strtotime() should return 0 if the argument is also 0

How can I get the function strtotime() to return 0 if the argument is also 0?
In my example, $testvar2 returns "empty".
$testvar = 0;
$testvar2 = strtotime($testvar);

print_r($testvar2);

A:

Its not returning empty its returning you bool(false). Check with var_dump instead of print_r.
Workaround:
$testvar2 = ($testvar) ? strtotime($testvar) : 0;

A:

Just simply make a ternary operator, since strtotime() will return false if it fails you can simply return 0 otherwise it will return the correct value.
$testvar2 = strtotime($testvar)?:0;

