
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Reading and Storing a List as an Array in PHP
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
Advertisements