Код: Выделить всё
function ddtt_get_file_eol( $file_contents, $incl_code = true ) {
$types = [
'\r\n',
'\n',
'\r'
];
$found = [];
foreach ( $types as $type ) {
if ( $type == '\r\n' ) {
$regex = "/\r\n/";
} elseif ( $type == '\n' ) {
$regex = "/(?
Подробнее здесь: [url]https://stackoverflow.com/questions/78664170/finding-all-types-of-end-of-line-delimiters-in-a-file[/url]
Мобильная версия