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?")

Ready to elevate your website?

Whether you're launching a new site, strengthening security, or adding a new feature, I can help transform your vision into a high-performing online presence.

Discuss your web development project

More Website Development posts

Structured data for SEO

Adding structured data to a website is one of those steps that often gets overlooked, yet it can make a real difference to how a site performs in search engines.…

Continue reading

Ensuring a smooth deployment of a PHP website application

Deploying a PHP website application requires meticulous planning, a solid understanding of the environment, and a thorough execution process. To ensure a smooth deployment, it is essential to follow best…

Continue reading

Knack API Integration

Knack is a powerful low-code platform that allows you to build online databases and custom web applications. When integrating Knack with your own systems or custom front ends, you can…

Continue reading

Popular PHP frameworks

Here’s detailed look at some of the most popular PHP frameworks, each of which can help speed up development, improve code organisation, and enhance application performance. Laravel Laravel is one…

Continue reading