public static function prepareParse (string $input, bool $allowFile) : array
    {
        // Is string or is file ?
        if ($allowFile === true && is_file($input)) :
            $input = file_get_contents($input);
        endif;

        // Line
        $input = preg_replace("(\r\n|\n|\r)",';',$input);
        $input = explode(';', $input);

        // Delete comments
        foreach ($input as &$line) :
            // Delete comments
            $is_comment = mb_strpos($line, '#');
            if ($is_comment !== false) :
                $line = substr($line, 0, $is_comment);
            endif;

            // Trim
            $line = trim($line);
        endforeach;

        return $input;
    }
public static function prepareParse (string $input, bool $allowFile) : array
    {
        // Is string or is file ?
        if ($allowFile === true && is_file($input)) :
            $input = file_get_contents($input);
        endif;

        // Line
        $input = preg_replace("(\r\n|\n|\r)",';',$input);
        $input = explode(';', $input);

        // Delete comments
        foreach ($input as &$line) :
            // Delete comments
            $is_comment = mb_strpos($line, '#');
            if ($is_comment !== false) :
                $line = substr($line, 0, $is_comment);
            endif;

            // Trim
            $line = trim($line);
        endforeach;

        return $input;
    }
public static function prepareParse ( string $ input , bool $ allowFile ) : array { // Is string or is file ? if ( $ allowFile === true && is_file ( $ input ) ) : $ input = file_get_contents ( $ input ) ; endif ; // Line $ input = preg_replace ( "(\r\n|\n|\r)" , ';' , $ input ) ; $ input = explode ( ';' , $ input ) ; // Delete comments foreach ( $ input as & $ line ) : // Delete comments $ is_comment = mb_strpos ( $ line , '#' ) ; if ( $ is_comment !== false ) : $ line = substr ( $ line , 0 , $ is_comment ) ; endif ; // Trim $ line = trim ( $ line ) ; endforeach ; return $ input ; }
Generic action before parsing data from string input
Generic action before parsing data from string input