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
Parsing JSON array with PHP foreach
The below code can be used to parse JSON array −
Example
<?php
$json_array ='{
"values": {
"a": "abc",
"d": 0,
"efg": 349
}
}';
$array = json_decode($json_array, true);
foreach($array as $values) {
echo $values['efg'];
echo $values['d'];
echo $values['a'];
}
Output
This will produce the following output −
3490abc
Advertisements