Mistři v programování na #hovnokod

zase romca perli

    public function UPOLOZKYAction($request) 
    {
        
        $this->view->setTemplateFile('blank.php');
        
        $file = file('./ANS-import/2008SDL.txt');
        
        $i = 0;
        
        $arr = array();
        foreach ($file as $line)
        {
            $i++;
            
            if ($i <= 4 || preg_match('~^\[~', $line))
                continue;
            else
            {
               $arr[] = $line;
            }
        }
        
        
        $a = explode(';', $arr[0]);
        
        //debug($a);
        
        $fillIt = function($a , $arr)
        {
            $b = explode(';', $arr);
            $relations = array();
            for ($i = 0; $i < count($a) - 1; $i++)
            {
                $relations[$a[$i]] = $b[$i];
            }
            
            return $relations;
        };
        
        unset($arr[0]);
        
        $relations = array();
        foreach ($arr as $arr2)
        {
            $relations[] = $fillIt($a, $arr2);
        }
        
        
        debug($relations);
       
 
    }

Anonymous,