Tools/ArrayTools.php
/**
     * keyed associative array to hierarchical associative array
     * example[subkey1.subkey2] to example[subkey1][subkey2]
     * this is a more valuable tool to dump yaml files pretty
     *
     * @param mixed $data
     * @param bool  $sortKeys
     *
     * @return array
     */
keyed associative array to hierarchical associative array
example[subkey1.subkey2] to example[subkey1][subkey2]
this is a more valuable tool to dump yaml files pretty

@param mixed $data
@param bool  $sortKeys

@return array
keyed associative array to hierarchical associative array example [ subkey1 . subkey2 ] to example [ subkey1 ] [ subkey2 ] this is a more valuable tool to dump yaml files pretty @param mixed $data @param bool $sortKeys @return array
public static function keyedAssocToHierarchical($data, $sortKeys = self::DO_NOT_SORT_KEYS)
    {
        if(self::SORT_KEYS == $sortKeys){
            ksort($data);
        }
        $result = array();
        foreach($data as $key=>$value){
            if($value!==null){
                $keys = explode('.',$key);
                $node = $value;
                for($i = count($keys); $i>0; $i--){
                    $k = $keys[$i-1];
                    $node = array($k => $node);
                }
                $result = array_merge_recursive($result, $node);
            }
        }
        return $result;
    }
public static function keyedAssocToHierarchical ( $ data , $ sortKeys = self :: DO_NOT_SORT_KEYS ) { if ( self :: SORT_KEYS == $ sortKeys ) { ksort ( $ data ) ; } $ result = array ( ) ; foreach ( $ data as $ key => $ value ) { if ( $ value !== null ) { $ keys = explode ( '.' , $ key ) ; $ node = $ value ; for ( $ i = count ( $ keys ) ; $ i > 0 ; $ i -- ) { $ k = $ keys [ $ i - 1 ] ; $ node = array ( $ k => $ node ) ; } $ result = array_merge_recursive ( $ result , $ node ) ; } } return $ result ; }
keyed associative array to hierarchical associative array
 example[subkey1.subkey2] to example[subkey1][subkey2]
 this is a more valuable tool to dump yaml files pretty
keyed associative array to hierarchical associative array example [ subkey1 . subkey2 ] to example [ subkey1 ] [ subkey2 ] this is a more valuable tool to dump yaml files pretty