How to flip a string? It was Hello - it became TevirP .
Do not offer the standard function - strrev() does not work with utf-8 encoding.
Options that made:
- Use mbstring. Passing a loop from the end of the line, we get letters through
mb_substr(), we form the final line. - Use regular expressions. Fetching characters through
preg_match_all()into an array, doingarray_reverse()andimplode().
Tell me more options for algorithms / implementations of such a transformation.
strrevsupports all encodings because it does not work with them. the function inverts the byte order, and how higher a client interprets these bytes a level — the client's problem. therefore, the statement “supports utf” and any other type “supports <insert any value>” is true - Lexx918