PHP – Regex: Check If String Contains Character Other Than A-Z


if (preg_match (‘/[^a-z]/i’, $string_to_check)) {
// The string contains characters other than a-z and A-Z
}

Advertisements

PHP: Using Ampersand Character From XML String


use htmlspecialchars_decode function

eg: $str = htmlspecialchars_decode($str);

or…

use str_replace function

eg: $str = str_replace(‘&’, ‘&’, $str);

 

source:

http://stackoverflow.com/questions/6379283/remove-amp-from-string-when-writing-to-xml-in-php