F
F
FastClick2020-06-12 09:45:15
PHP
FastClick, 2020-06-12 09:45:15

Convert text to array?

There is a function str_split();that converts a string to an array.
When used: Output:
print_r(str_split("тест"));

Array
(
    [0] => ?1?
    [1] => ?2?
    [2] => ?1?
    [3] => ?2?
    [4] => ?1?
    [5] => ?2?
    [6] => ?1?
    [7] => ?2?
)


Although everything is fine with the English word test, how can I fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2020-06-12
@FastClick

This function is not designed to work with unicode.
More details in the comments https://www.php.net/manual/en/function.str-split.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question