How to convert string to array of words in PHP

1 Answer

0 votes
$s  = "php java python c c++ c#";

$arr = explode(" ", $s);

print_r($arr);



/*
run:

Array
(
    [0] => php
    [1] => java
    [2] => python
    [3] => c
    [4] => c++
    [5] => c#
)

*/

 



answered Jan 29, 2021 by avibootz
...