@ 2017-07-09T16:43:50Z <?php
function checkPositiveInt($var) {
if (is_numeric($var)) {
if (is_int($var)) {
if ($var > 0) {
return true;
}
}
}
return false;
}
$devidL = '05.08.2017';
$arrayInputsState['devid'] = '';
if ($devidL != '') {
$arrayDate = explode(".", $devidL);
$numberOfValid = 0;
if (checkPositiveInt($arrayDate[0])) {
$day = (int)$arrayDate[0];
++$numberOfValid;
}
if (checkPositiveInt($arrayDate[1])) {
$month = (int)$arrayDate[1];
++$numberOfValid;
}
if (checkPositiveInt($arrayDate[2])) {
$year = (int)$arrayDate[2];
++$numberOfValid;
}
if ($numberOfValid == 3) {
if (checkdate($month, $day, $year)) {
$date = \DateTime::createFromFormat('d.m.Y', $devidL);
if ($date) {
$Zaznam->setDEVID($date);
$arrayInputsState['devid'] = 'ok';
} else {
$arrayInputsState['devid'] = 'error';
}
} else {
$arrayInputsState['devid'] = 'error';
}
}
} else {
$arrayInputsState['devid'] = 'empty';
}
echo 'vysledok je <br>';
var_dump($arrayInputsState['devid']);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 vysledok je <br>string(0) ""
Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
vysledok je <br>string(0) ""
preferences:dark mode live preview
230.04 ms | 402 KiB | 291 Q