PHP: str_replace

str_replace($search,$replace,$subject)

All instances of $search are replaced with $replace in $subject.

// Will print to screen: "Why is the sky blue?". 
echo str_replace("red","blue","Why is the sky red?")

Published by

Keith Greer

Senior PHP and Magento Web Developer in Belfast, Northern Ireland.