3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
60.07 ms | 402 KiB | 5 Q