Showing posts with label replace. Show all posts
Showing posts with label replace. Show all posts

Thursday, May 19, 2016

Recursive Text Replacer Search And Replace Text PHP Script

This php script replaces all occurrences of the search string with the replacement string in files matching specified mask. It could be for example your Google AdSense id or some affiliate code.

Features:

  • Enable/disable recursion
  • Supports file mask
  • Email results

Only one PHP file. Does not need any third-party components. 

Download Recursive Text Replacer PHP Script

Wednesday, May 18, 2016

How To Replace Smart Quotes Microsoft Encoded Quotes In PHP

Many people have emailed and asked me about how can they replace those Smart Quotes using PHP.Well the answer is that there are many ways to do so.In this example I will explain it with a function that will do the job.

Use the function below to replace Smart Quotes easily.

function convert_smart_quotes($string) 
{
$search = array(chr(145),
chr(146),
chr(147),
chr(148),
chr(151));

$replace = array("",
"",
",
",
-);

return str_replace($search, $replace, $string);
Thats it! The function should work perfectly.Some minor changes may be needed here and there in this php script to suit your specific needs in particular.Hope you liked this piece of code.

Enjoy!