faster way to replace the strings in multidimensional arra

<?php
//A faster way to replace the strings in multidimensional array
function strReplace($search, $replace, $string)
{
    return json_decode(
        str_replace(
            $search,
            $replace,
            json_encode($string)
        )
    );
}