iconv() is just a shell around the iconv() function found in the C system library where PHP runs (if PHP is not built using GNU iconv, GNU iconv is used in this case). Thus, the performance and functions of iconv() depend on where you use PHP and how it is built.
The implementation of mb_convert_encoding() , on the other hand, is included in the source code of PHP (the module). It includes a library called libmbfl that handles the actual conversion. This way it works the same no matter where you use PHP. Here is a list of supported encodings: http://php.net/manual/en/mbstring.encodings.php
So, in general, I think you could say that mb_convert_encoding() more reliable to use if you want to support different platforms. However, if you use iconv() on Linux (for example), then it supports a lot more encodings (see iconv --list ).
The relative performance of functions also depends on the particular implementation of iconv() , obviously.
pelle Aug 26 '14 at 15:53 2014-08-26 15:53
source share