3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string="{1},[2],(3),<4>"; $string = preg_replace_callback('~([{[<])|[]}>]~', function ($m) { return !empty($m[1]) ? "(" : ")"; }, $string); echo $string;

preferences:
77.86 ms | 402 KiB | 5 Q