예제 #1
0
파일: test.php 프로젝트: sparrow41/training
function Dziusio_substr_rev($text, $count)
{
    $length_of_str = Dziusio_strlen($text);
    $wynik = '';
    for ($i = $length_of_str - $count; $i < $length_of_str; $i++) {
        $wynik .= $text[$i];
    }
    return $wynik;
}
예제 #2
0
 protected function ValidateCheckSum($pesel)
 {
     $temp = CheckSum($pesel);
     $lengthPesel = Dziusio_strlen($pesel);
     if ($temp == 0 && $pesel[$lengthPesel - 1] == 0) {
         return true;
     }
     if ($temp >= 1 && $temp <= 9 && $pesel[$lengthPesel - 1] == $temp) {
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
 function SortTable($table)
 {
     $len = Dziusio_strlen($table);
     $temp = 0;
     for ($i = 0; $i < $len; $i++) {
         for ($j = $i; $j < $len; $j++) {
             if ((int) $table[$j] < (int) $table[$i]) {
                 $temp = $table[$i];
                 $table[$i] = $table[$j];
                 $table[$j] = $temp;
             }
         }
     }
 }
예제 #4
0
 function IsStringLettersInString($subject, $seek)
 {
     SortTable($subject);
     SortTable($seek);
     $len = Dziusio_strlen($seek);
     $len2 = Dziusio_strlen($subject);
     $temp = 0;
     $j = 0;
     $k = 0;
     for ($i = 0; $i < $len; $i++) {
         for ($j = $k; $j < $len2; $j++) {
             if ((int) $subject[$j] == (int) $seek[$i]) {
                 $temp++;
                 $k = $j;
                 if ($len == $temp) {
                     return true;
                 }
             }
         }
     }
     return false;
 }