Potresti postare un esempio contenente le variabili $array_iniziale, $gerarchia e $stringa valorizzate?