str_replace('+', '-', str_replace('/', '_', $val)) code example Example: php replace str_replace ($search, $replace, $subject);