- var_dump: documentation ( source)
- bin2hex: documentation ( source)
- strtr: documentation ( source)
- str_replace: documentation ( source)
<?php
$code = "-\r-\r\n-\n-";
$hex = bin2hex($code);
var_dump($hex);
$code1 = str_replace("\r\n", "\n", $code);
$hex = bin2hex($code1);
var_dump($hex);
$code2 = str_replace(array("\r\n", "\r"), "\n", $code);
$hex = bin2hex($code2);
var_dump($hex);
$code3 = strtr($code, array(
"\r\n" => PHP_EOL,
"\r" => PHP_EOL,
"\n" => PHP_EOL,
));
$hex = bin2hex($code3);
var_dump($hex);