string : The effect of leadership on work motivation
how to make the string to be like this:
Arrays
(
[0] => The effect
[1] => effect of
[2] => of leadership
[3] => leadership on
[4] => on work
[5] => work motivation
)
3
Answers
One way is to explode and then loop to make desired array… have a look at code…
Result:
Explode your initial string on
<space>
, then iterate along the resulting array, creating new strings from the result.Output:
See https://3v4l.org/Flgl0
A possible solution: