|
Ok!
|
|
|
Ok!
|
---|---|---|---|---|
5 | function cmp($a,$b){ return strtotime($a['PROPERTY_DATER_VALUE'])<strtotime($b['PROPERTY_DATER_VALUE']); } usort($item_happ,"cmp"); | функция, сравнение дат, даты, php | 30 | Пример функции сравнения в php |
4 | Character Meaning Example . Matches any single character – c.t will match cat, cot, cut, etc. + Repeats the previous match one or more times – a+ matches a, aa, aaa, etc * Repeats the previous match zero or more times. – a* matches all the same things a+ matches, but will also match an empty string. ? Makes the match optional. colou?r will match color and colour. ^ Called an anchor, matches the beginning of the string ^a matches a string that begins with a $ The other anchor, this matches the end of the string. a$ matches a string that ends with a. ( ) Groups several characters into a single unit, and captures a match for use in a backreference. (ab)+ matches ababab - that is, the + applies to the group. For more on backreferences see below. [ ] A character class - matches one of the characters c[uoa]t matches cut, cot or cat. [^ ] Negative character class - matches any character not specified c[^/]t matches cat or c=t but not c/t | регулярные выражения, regexp | 10 | Значения символов регулярного выражения |
3 | setlocale( LC_ALL, "ru_RU.UTF-8" ); strftime("%A %e %B %Y", mktime(0, 0, 0, 1, 1, 2016)); | дата по-русски, php дата | 100 | Вывод даты в php в русской локали |
2 | $text = iconv(mb_detect_encoding($det, mb_detect_order(), true), "UTF-8", $det); | encoding, кодировка, перекодировать, Конвертация | 150 | Конвертация из любой кодировки в utf-8 |
1 | function rus2translit($string) { $converter = array( 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ь' => 'j', 'ы' => 'y', 'ъ' => 'j', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', 'Ж' => 'Zh', 'З' => 'Z', 'И' => 'I', 'Й' => 'Y', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sch', 'Ь' => 'j', 'Ы' => 'Y', 'Ъ' => 'j', 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya', ' ' => '_', '№' => 'No' ); return strtr($string, $converter); } function str2url($str) { $str = rus2translit($str); $str = strtolower($str); $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str); $str = trim($str, "-"); return $str; } | translit, транслит, php | 15 | Транслит |