This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $text | |
* @return array | |
*/ | |
function getTopFiveWords(string $text) : array | |
{ | |
mb_internal_encoding("UTF-8"); | |
// (!) optional, just in case... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Пошёл по самому простому пути для примера. | |
* | |
* Подразумевается, что данный класс будет использоваться только для таблиц с колонкой deleted | |
* `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0' | |
* | |
* пример использования для Customer extends AppActiveRecord: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function cartesian($input) { | |
$result = array(); | |
while (list($key, $values) = each($input)) { | |
// If a sub-array is empty, it doesn't affect the cartesian product | |
if (empty($values)) { | |
continue; | |
} |