Skip to content

Instantly share code, notes, and snippets.

<?
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;
}
<?php
/**
*
* Пошёл по самому простому пути для примера.
*
* Подразумевается, что данный класс будет использоваться только для таблиц с колонкой deleted
* `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0'
*
* пример использования для Customer extends AppActiveRecord:
*
<?php
/**
* @param string $text
* @return array
*/
function getTopFiveWords(string $text) : array
{
mb_internal_encoding("UTF-8");
// (!) optional, just in case...