-1

I can convert a string 'html php js' to array using explode, such as

$string = 'html php js';
$output_array = explode(' ', $string);

and it works fine. But how to convert a string that has no spaces?

$string = 'html';

// *** outputs as ['h','t','m','l']

and that the output has to be an array of strings.

1

1 Answer 1

-1

Try to use the str_split function: https://www.php.net/manual/en/function.str-split.php

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.