

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 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
- Related Questions & Answers
- Storing objects in PHP session
- Reading a text file into an Array in Node.js
- Reading/Writing a MS Word file in PHP
- Reading a colored image as grey scale using Java OpenCV library.
- Reading Attributes with Reflection API in PHP 8
- How to create comma separated list from an array in PHP?
- What is the difference between a python list and an array?
- Sort an array and place a particular element as default value in JavaScript
- Reading an image using Python OpenCv module
- How to delete an element from an array in PHP and re-index the array?
- Reading and Writing Files in Perl
- Reading and Writing Files in Python
- Reading and displaying images using OpenCV
- What is the difference between a list and an array in C#?
- Opening and reading a file with askopenfilename in Tkinter?
Advertisements