For dummies, in PHP what is the difference between single-byte strings and multi-byte strings and in which situations should we consider one or another?
For single-byte strings (e.g. US-ASCII, ISO 8859 family, etc.) use substr and for multi-byte strings (e.g. UTF-8, UTF-16, etc.) use mb_substr:
// singlebyte strings $result = substr($myStr, 0, 5); // multibyte strings $result = mb_substr($myStr, 0, 5);
For instance, if I plan to develop something to be used in china, do I need to adopt any special measures because of their special characters ? Isnt' Utf-8 encoding good enough?