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:
25.3 ms | 404 KiB | 5 Q