Convert PHP XML to JSON, XML to Array, JSON to Array
Converting PHP XML to JSON, XML to Array, JSON to Array is very difficult task for some people. But, in PHP, believe me it’s very easy. One line of code each! Don’t believe? Just check out the code below and test it yourself!
1 2 3 |
$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml);
$arr = json_decode($json,true);
|
Happy Coding!
Leave a comment
Welcome to my Blog
Categories
- checkout (4)
- eCommerce (2)
- humor (3)
- JSON (1)
- Linux (4)
- Magento (72)
- Magento admin (32)
- Magento Certification (2)
- Magento error (6)
- Magento frontend (32)
- Magento Interview (5)
- mobile (1)
- MySQL (5)
- PHP (6)
- Ubuntu (3)
- Wordpress (1)
- XML (2)
Archives
Tag Cloud
absolute path
admin
android
answers
attribute
block
category
controller
cookie
customer
difference
directory
EAV
ebay aquires magento
ecommerce
error
factory
froyo
functions
gingerbread
inkfruit
interview
is null
magento
magento admin
magento design patterns
magento error
magento orm
magento sample product purchase
mysql
navigation
order
order sample of product
php
product
query is null
questions
relative path
samsung
session
simplexml to array
study guide
upgrade
url
versus

This blog is merely to record the things that I find interesting. It can be technical, humor, news, creative or anything that deserves to be posted here. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!