3v4l.org

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

preferences:
81.98 ms | 1608 KiB | 5 Q