Application.php
public static function getAbbreviations($names)
    {
        $abbrevs = array();
        foreach ($names as $name) {
            for ($len = strlen($name); $len > 0; --$len) {
                $abbrev = substr($name, 0, $len);
                $abbrevs[$abbrev][] = $name;
            }
        }

        return $abbrevs;
    }
public static function getAbbreviations($names)
    {
        $abbrevs = array();
        foreach ($names as $name) {
            for ($len = strlen($name); $len > 0; --$len) {
                $abbrev = substr($name, 0, $len);
                $abbrevs[$abbrev][] = $name;
            }
        }

        return $abbrevs;
    }
public static function getAbbreviations ( $ names ) { $ abbrevs = array ( ) ; foreach ( $ names as $ name ) { for ( $ len = strlen ( $ name ) ; $ len > 0 ; -- $ len ) { $ abbrev = substr ( $ name , 0 , $ len ) ; $ abbrevs [ $ abbrev ] [ ] = $ name ; } } return $ abbrevs ; }
Returns an array of possible abbreviations given a set of names.

@param array $names An array of names

@return array An array of abbreviations
Returns an array of possible abbreviations given a set of names .