Tom: Ihr habt RECHT , highlight_string() spinnt

Beitrag lesen

Hello,

highlight_string
Soviele Windows Zeilenumbrüche \r\n :0
Soviele UNIX Zeilenumbrüche \n :2
Soviele MAC Zeilenumbrüche \r :4

Wie geht denn das?
Das muss ich mir im Hex-Editor ansehen.

Ergebnis:

in der Standardeinstellung von PHP ersetzt highlight_file() nur die "\n" also 0A gegen "<br />"
Die 0D also "\r" bleiben vollkommen unbeachtet, also auch im Ausgabetext erhalten. Für sie wird auch kein "<br />" eingefügt.

Teste mit der Einstellung

ini_set('auto_detect_line_endings',1);

Das macht keinen Unterschied.
Hat laut Manual ja auch nur Einfluss auf file() und fgets()

http://www.php.net/manual/en/ref.filesystem.php#ini.auto-detect-line-endings

auto_detect_line_endings boolean
When turned on, PHP will examine the data read by fgets() and file() to see if it is using Unix, MS-Dos or Macintosh line-ending conventions.

This enables PHP to interoperate with Macintosh systems, but defaults to Off, as there is a very small performance penalty when detecting the EOL conventions for the first line, and also because people using carriage-returns as item separators under Unix systems would experience non-backwards-compatible behaviour.

Note: This configuration option was introduced in PHP 4.3.0

Ich hoffe, alle Klarheiten sind nun wiederhergestellt

Harzliche Grüße vom Berg
http://www.annerschbarrich.de

Tom

--
Fortschritt entsteht nur durch die Auseinandersetzung der Kreativen
Nur selber lernen macht schlau