', '"', "'", '-'), array('&', '<', '>', '"', ''', '-'), $str ); // Decode the temp markers back to entities $str = preg_replace('/'.$temp.'(\d+);/', '&#\\1;', $str); if ($protect_all === TRUE) { return preg_replace('/'.$temp.'(\w+);/', '&\\1;', $str); } return $str; } }