3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "James said hello\n\n\n\n Test\n Test two\n\n"; echo json_encode( preg_replace("/\n{2,}/", "\n", $string) ); echo "\n---\n"; $string = "James\r\n said\n\r\n hello\r\n\r\n\r\n Test\n Test two\n\n"; echo json_encode( preg_replace("/\R{2,}/", PHP_EOL, $string) );
Output for git.master, git.master_jit, rfc.property-hooks
"James said hello\n Test\n Test two\n" --- "James\r\n said\n hello\n Test\n Test two\n"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
29.09 ms | 405 KiB | 5 Q