3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "[spoiler]Test\ntesting[/spoiler]."; $text = preg_replace_callback("/\[spoiler\](.*?)\[\/spoiler\]/", function($match){ $lines = explode("\n", str_rot13(substr($match[0]))); echo "test"; $output = ""; foreach ($lines as $line) { $output .= "[spoiler]".$line."[/spoiler]"; } return $output; }, $text ); echo $text; ?>

preferences:
38.75 ms | 402 KiB | 5 Q