Ouzo\Utilities\Strings::remove PHP Method

remove() public static method

Example: $string = 'winter is coming???!!!'; $result = Strings::remove($string, '???'); Result: winter is coming!!!
public static remove ( string $string, string $toRemove ) : mixed
$string string
$toRemove string
return mixed
    public static function remove($string, $toRemove)
    {
        $string = is_int($string) ? "{$string}" : $string;
        $toRemove = is_int($toRemove) ? "{$toRemove}" : $toRemove;
        if (is_null($string) || is_null($toRemove)) {
            return $string;
        }
        return str_replace($toRemove, '', $string);
    }

Usage Example

Beispiel #1
0
function addFile(array $fileInfo = array(), $stringToRemove = '')
{
    if (!empty($fileInfo)) {
        $prefixSystem = Config::getValue('global', 'prefix_system');
        $suffixCache = Config::getValue('global', 'suffix_cache');
        $suffixCache = !empty($suffixCache) ? '?' . $suffixCache : '';
        $url = $prefixSystem . $fileInfo['params']['url'] . $suffixCache;
        $url = Strings::remove($url, $stringToRemove);
        return _getHtmlFileTag($fileInfo['type'], $url);
    }
    return null;
}
All Usage Examples Of Ouzo\Utilities\Strings::remove