note 88094 deleted from function.chr by danbrown
| From: | danbrown@php.net | Date: | Fri, 09 Jan 2009 23:25:24 +0000 |
| Subject: | note 88094 deleted from function.chr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149020@lists.php.net to get a copy of this message | ||
Note Submitter: WGR Studio
----
English:
Pyramid keops to create tables of characters (I used to create the categories and subcategories in
several levels ...: p
They took me 4 days to reach the design desired result
WARNING! Heavy algorithm
Français:
la pyramide de keops pour la création des tableaux des caractères (il me servent a créer
des catégories et sous catégories en plusieurs niveaux... :p
Ils m'ont fallu 4 jours de conception pour arriver au résultat désirée
ATTENTION!!! Algorithme lourd
<?php
/**
* @author WGR Studio
* @email webmaster[at]wgrstudio[dot]com
* @website http://www.wgrstudio.com/
* @company WGR Studio
* @copyright 2002 - 2009
* @project WGR CMS
*
**/
ob_start();
echo ("ROOT ");
ini_set("memory_limit", -1);
function getRoot($limita) {
$limita = ($limita < 1?1:($limita > 10?10:$limita));
$arata = range(chr(97), chr((96 + $limita)));
$caractere = range(chr(65), chr(90));
for ($theads = 0; $theads < sizeof($arata); ++$theads):
$thead = $arata[$theads];
$return[$thead] = getIndex($thead, ($limita - 2));
endfor;
return $return;
}
flush();
function getIndex($litera = false, $adancime = 0) {
$caractere = range(chr(97), chr(122));
if ($litera):
if ($adancime > 0):
foreach ($caractere as $a => $b):
$return[$b] = getIndex($b, ($adancime - 1));
endforeach;
return $return;
endif;
$return[$litera] = $caractere;
return $return[$litera];
endif;
return $caractere;
}
echo ("<pre>");
print_r(getRoot(3));
#var_dump(getRoot(3));
echo ("</pre>");
flush();
ob_end_flush();
/**
* The contents of this file is used only in projects designed by WGR Studio.
* Any change lines below can cause errors in the functioning of the software.
*
* @project WGR CMS
* @copyright 2002 - 2009
**/
?>