src/StringLib.php
/**
     * Converts any newlines to the systems format.
     * The use of " instead of ' is very important!
     * @param $input - any string input
     * @return $output - the newly reformatted string
     */
Converts any newlines to the systems format.
The use of " instead of ' is very important.
@param $input - any string input
@return $output - the newly reformatted string
Converts any newlines to the systems format . The use of " instead of ' is very important . @param $input - any string input @return $output - the newly reformatted string
public static function convertLineEndings($input)
    {
        $output = str_replace("\r\n", "\n",  $input);
        $output = str_replace("\r",   "\n",  $output);
        $output = str_replace("\n", PHP_EOL, $output);
        return $output;
    }
public static function convertLineEndings ( $ input ) { $ output = str_replace ( " \r \n " , " \n " , $ input ) ; $ output = str_replace ( " \r " , " \n " , $ output ) ; $ output = str_replace ( " \n " , PHP_EOL , $ output ) ; return $ output ; }
Converts any newlines to the systems format.
Converts any newlines to the systems format .
# This must be first as it is the most specific of the endlines. # There are some strange cases where it is just \r # the system might be windows!