function str_tree($arr, $i = 0)
{
$res = array();
if( isset($arr[$i]) ){
$res[] = $arr[$i++];
$res['sub'] = str_tree($arr, $i);
}
return $res;
}
function str_tree($arr, $i = 0)
{
return isset($arr[$i]) ? array($arr[$i++], 'sub' => str_tree($arr, $i)) : NULL;
}