How To Clean Special Characters From PHP String

If you are looking for the PHP special characters clean function then this post might be useful for you. This function can used to remove special character as well as able to replace specific character with other equivalent character or string. Here is detailed explanation of function: $specialCharacters Array: This array used to replace special character with other character or string. if you want to interchange (+) with (plus) then you need to specify in the array. You can add/remove array element according to your requirement. strtr function: This function used to replace other language special characters to plain English character. You can remove this line safely but ensure before that these characters not in your string and you don't need to remove them. Last 4 line used to remove other unknown unwanted special characters. [sourcecode language='php'] function just_clean($string) { // Replace other special chars $specialCharacters = array( '#' => '', '$' => '', '%' => '', '&' => '', '@' => '', '.' => '', '€' => '', '+' => '', '=' => '', '§' => '', '\\' => '', '/' => '', ); while (list($character, $replacement) = each($specialCharacters)) { $string = str_replace($character, '-' . $replacement . '-', $string); } $string = strtr($string, "ÀÁÂÃÄÅ? áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn" ); // Remove all remaining other unknown characters $string = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $string); $string = preg_replace('/^[\-]+/', '', $string); $string = preg_replace('/[\-]+$/', '', $string); $string = preg_replace('/[\-]{2,}/', ' ', $string); return $string; } [/sourcecode]
WordPress 406 Not Acceptable Error Fix

WordPress 406 Not Acceptable Error Fix

I just received "Not Acceptable Error while i tried to edit post in Word Press 2.5. Earlier, It was working fine but in the previous post i get annoying error when i tried to save and continue my article. But soon i realize cause of the error. Again, the error…continue reading →

PHP Fatal Error Fix: Can’t use method return value in write context

PHP compiler generate fatal error if you use function return value in read/write context. Although this is not applicable for all PHP supported function but PHP function like empty does not support use of the function in this way. In other words, php empty function cannot check the return value…continue reading →

WordPress 2.5 Popularity Contest Plugin Fatal Error Fix

If you are using Alex popularity plug-in then you might face this error while upgrading plug-in automatically in WP 2.5. This error generate due to invalid wp-header file path in plug-in file. Unfortunately, Alex not released new fixed version of the this popular plug-in. However, fix is really very simple…continue reading →

CubeCart 4.x.x Cross-Site Scripting Vulnerabilities

Two vulnerabilities has been discoverd in CubeCart 4.xx by Russ McRee that can be use by hackers to exploit website by cross-site scripting attacks. The search input string is not properly sanitised before passed to script for execution. This behaviour can be used by attacker to execute malicious script code…continue reading →
Google Custom Search Engine Plugin for WordPress

Google Custom Search Engine Plugin for WordPress

Google CSE is very nice plug-in to create Google custom search engine from your wordpress blog roll. This plug-in uses xml file for configuration. With this plug-in visitors will be able to search your blog roll and your blog instead of searching entire world wide web. The 2.0 version is…continue reading →

Connect to your PC over internet with SynXro

SynXro is another web based product to connect, a PC to PC; or PC to LAN connection. SynXro allows you to access all the drives of your PC and all the network drives of all PCs connected to your Local Area Network from anywhere in the world. You only need…continue reading →

Uber Uploader ClipShare Rayzz Ostube Failed to Find File Length Error

You may receive "Failed To Find Flength File" error during file upload using uber uploader. The main cause of this problem is due to apache mod_security enabled on your host. Apache mod_security may prevent writing flength file duing file upload. This will cause uploder to determine file length for percentage…continue reading →
Add voice to your post and website with vozMe

Add voice to your post and website with vozMe

vozMe introduced new cool text to voice service. This service available in English,Español, and Italiano language. vozMe service also availble as Google Gadget and Wordpress plugin. You can add voice on your website page and blog post. A working version can be find at last of this blog post. Simply…continue reading →
How to add php code to word press blog widget

How to add php code to word press blog widget

Word Press default widget does not allow you to use php code. You can do this by simply editing template files but this is not overall solution. By doing this you are loosing beauty of widget drag and drop functionality. The Samsarin PHP Widget available as plug-in that allow user…continue reading →