div containers position
Main keywords which controls div contrainers position: float: left; and clear: left;
Size by side example:
One on top of other example:
Main keywords which controls div contrainers position: float: left; and clear: left;
Size by side example:
One on top of other example:
git clean -fd
git reset
Моcк — имитация объекта
Stub — заглушка для метода
1. Adding subtree to current project
git remote add mysubproject git@github.com:iaghayev/mysubproject.git git subtree add --prefix=path/to/somedir mysubproject master |
2. Committing changes to subproject from path/to/somedir folder
git subtree push --prefix=path/to/somedir mysubproject master |
3. Getting latest code changes from subproject
git subtree pull --prefix=path/to/somedir mysubproject master |
<?php function calcCheckDigit($inputCode) { $btArray = str_split($inputCode); $total = 0; for ($index = 0; $index < sizeof($btArray); $index++) { $btChr = ord($btArray[$index]); if ($btChr == 60) { //convert spacer char < to 0 $btArray[$index] = 0; } else if ($btChr >= 65) { //convert letters A-Z to 10-35 $btArray[$index] = $btChr - 55; } else { //take numbers literally $btArray[$index] = $btChr - 48; } switch ($index % 3) { case 0: $btArray[$index] *= 7; break; case 1: $btArray[$index] *= 3; break; case 2: $btArray[$index] *= 1; break; } $total += $btArray[$index]; } return (int) $total % 10; } $mrz2 = '7553279419RUS8712242M2104131>>>>>>>>>>>>>>02'; // check the document number vs its check digit $documentNumber = substr($mrz2, 0, 9); $documentNumberCheckDigit = (int) substr($mrz2, 9, 1); if ($documentNumberCheckDigit != calcCheckDigit($documentNumber)) { echo "document number incorrect.\n"; } // check the DOB vs its check digit $dob = substr($mrz2, 13, 6); $dobCheckDigit = (int) substr($mrz2, 19, 1); if ($dobCheckDigit != calcCheckDigit($dob)) { echo "DOB incorrect.\n"; } // check the DateOfExpiry vs its check digit $dateOfExpiry = substr($mrz2, 21, 6); $dateOfExpiryCheckDigit = (int) substr($mrz2, 27, 1); if ($dateOfExpiryCheckDigit != calcCheckDigit($dateOfExpiry)) { echo "Date Of Expiry incorrect.\n"; } // check the optional data field vs its check digit $optionalData = substr($mrz2, 28, 14); if ($optionalData != str_repeat(chr(60),14)) { $optionalDataCheckDigit = (int) substr($mrz2, 42, 1); if ($optionalDataCheckDigit != self::calcCheckDigit($optionalData)) { echo "Optional data incorrect.\n"; } } //positions 1 to 10, 14 to 20, and 22 to 43 $wholeLine = substr($mrz2, 0, 10) . substr($mrz2, 13, 7) . substr($mrz2, 21, 22); $wholeLineCheckDigit = (int) substr($mrz2, 43, 1); if ($wholeLineCheckDigit != self::calcCheckDigit($wholeLine)) { echo "Whole line incorrect.\n"; } |
Normally, when a function is completed/executed, all of its variables are deleted. However, sometimes we want a local variable NOT to be deleted. We need it for a further job.
To do this use the static keyword.
<?php function recursive(&$myarray, $dir, $recursiveDir = null) { $items = scandir($dir); foreach ($items as $item) { if ($item != "." && $item != "..") { $file = $dir. DIRECTORY_SEPARATOR. $item; if (is_dir($file)) { definitions($routes, $file, $file); } else { // get name of api $expl = explode(".", $item); $key = ($recursiveDir !== null) ? basename($recursiveDir). '.'. $expl[0] : $expl[0]; $value = $expl[1]; $myarray[$key] = $value; } } $myarray = array(); recursive($myarray, ROOT . "app/project". DIRECTORY_SEPARATOR); print_r($myarray,1); |
<?php $url = function($folder) use ($hostname) { return $hostname . DIRECTORY_SEPARATOR . $folder; }; $hostname = "https://" . $_SERVER['SERVER_NAME']; $myurl = $url('pictures'); echo $myurl; // output // https://www.aghayev.com/pictures |