Forum Moderators: coopster
$sd = (int)substr($from, 0,2);
var_dump($sd); // Is this the value you expect? ie. (int)2
So is there an integer equivalent to substr?
$from = '02-08-2014'; // Hardcoded date string (expected result of processing)
$sd = substr($from, 0,2); // (string)'02'
$sm = substr($from, 3,2); // (string)'08'
$sy = substr($from, 6,4); // (string)'2014'
echo (checkdate($sm,$sd,$sy) ? 'OK' : 'BAD');
remove the leading zeros with trim