For this, you can simply use for loop.
Example
The PHP code is as follows
<!DOCTYPE html> <html> <body> <?php $list="10 20 30 40 50 60"; $arr=[]; $counter=0; for($i=0;$i<count($list);$i++){ if($list!==" "){ $arr[$counter++]=$list; } } foreach($arr as $t){ echo $t,"<br>"; } ?> </body> </html>
Output
This will produce the following output
10 20 30 40 50 60