mixed str_replace (string occurrence, mixed replacement, mixed str [, int count])

The str_replace() function executes a case-sensitive search for occurrence in str, replacing all instances with replacement. If occurrence is not found in str, then str is returned unmodified. If the optional parameter count is defined, then only count occurrences found in str will be replaced.

This function is ideal for hiding e-mail addresses from automated e-mail address retrieval programs:

$author = "[email protected]";

$author = str_replace("@","(at)",$author);

echo "Contact the author of this article at $author.";

This returns:

Contact the author of this article at jason(at)

Was this article helpful?

+1 0

Post a comment