0

How come I can't use normalizer function?

I am using it exactly as I should, ie: $var = normalizer_normalize($str);

I get php error: no such function!

Here is the code:

 $headline= mysql_real_escape_string($_POST['headline']);
 $ad_id_string=normalizer_normalize($headline);

Thanks

1 Answers1

1

From the docs, normalizer_normalize was included in PHP as of version 5.3.0. Prior to that, it was available as a PECL extension. To build it as part of PHP, you'll need to install internationalization support.

If you need to provide your own equivalent to the Normalizer class, strtr() would be a good option. The only downside is that you will need to provide your own character strings to translate to / from.

jheddings
  • 26,717
  • 8
  • 52
  • 65
  • What would you use prior to that then? All I need to do is convert swedish letters å (a with a ring on it) to a regular a... –  Nov 20 '09 at 22:48
  • There are answers to help with that on your previous question: http://stackoverflow.com/questions/1770250/how-to-remove-diacritics-from-text – jheddings Nov 20 '09 at 22:54