public static function replace($search, $replace, $string, $caseSensitive = true)
    {
        if (!self::isValid($replace)) {
            return false;
        }

        if (!$caseSensitive) {
            return str_ireplace($search, $replace, $string);
        } else {
            return str_replace($search, $replace, $string);
        }
    }
public static function replace($search, $replace, $string, $caseSensitive = true)
    {
        if (!self::isValid($replace)) {
            return false;
        }

        if (!$caseSensitive) {
            return str_ireplace($search, $replace, $string);
        } else {
            return str_replace($search, $replace, $string);
        }
    }
public static function replace ( $ search , $ replace , $ string , $ caseSensitive = true ) { if ( ! self :: isValid ( $ replace ) ) { return false ; } if ( ! $ caseSensitive ) { return str_ireplace ( $ search , $ replace , $ string ) ; } else { return str_replace ( $ search , $ replace , $ string ) ; } }
Replace a string with another string

@param string $search The string to look for
@param string $replace The replacement string
@param string $string The string to check
@param bool $caseSensitive Case sensitive replacement

@return string|bool
Replace a string with another string