Fonction récursive identique php
Bonjour,
J'essaye de construire une fonction récursive identique au php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| function developpe(&$inarray)
{
foreach ( $inarray as $inkey => $inval )
{
if ( is_array( $inval ) )
{
developpe($inval);
}
else
{
//code x
}
}
return $toarray;
} |
Est-ce possible?
voici mon code en javascript+mootools mais ceci ne fonction pas au niveau du "traitementchapitre (el1);"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
function traitementchapitre(ultrouver){
ultrouver.getChildren().get('id').each(function(el1, i) {
var replacementchiffre=numeroarticle+1;
var numerochapitre=$(el1).get('alt');
if(typeOf(numerochapitre)=='null')
traitementchapitre (el1);
});
}
traitementchapitre ($(ulpresent)); |
bonne journée
drick