PHP isn’t as easy as working with JSON

<?php
$list = array(
"eggs",
"bread",
"milk",
"bananas",
"bacon",
"cheese"
);
$xml = new SimpleXMLElement("<list />");
foreach($list as $item) {
$xml->addChild("item", $item);
}
// for nice output
$dom = dom_import_simplexml($xml)->ownerDocument;
$dom->formatOutput = true;
echo $dom->saveXML();


The starting point is the array that will be our list,
then a SimpleXMLElementobject is
instantiated with a root tag that forms the basis
 for the document. In XML, everything
has to be in a tag so an  <item>tag has been
 introduced in order to contain each list item.
The final block only makes the output prettier,
 which isn’t usually important because
XML is for machines, not for humans.
To get the XML to convert from a  SimpleXM
LElementobject, call the asXML()method
 on that object, which returns a string. The
string, however is all on one line!
The previous example instead converted
 from SimpleXMLElementto DOMElement, and
then grabbed the DOMDocumentfrom that.
 Set the formatOutputto true, so when a call
is made to DOMDocument::saveXML
  to ask it to return the XML as a string), the re‐
sulting output will be nicely formatted.

XML’s abilities to represent attributes, children,
 and character data all provide a more
powerful and descriptive way to represent data
than, for example, JSON. These same
features make XML a great way to represent very
 detailed information, including datatype information,
 so it’s a great choice when those details really do matter.
 It can include
PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP
information about the types of data and custom data types,
 and each element can have
attributes that cover even more information.

XML in PHP
There are many ways we can work with XML in PHP,
 and they’re all useful in differentsituations. There are
 three main approaches to choose from and they all have their
advantages and disadvantages:








  • PHP: JSON - Manual - PHP: Hypertext Preprocessor

    There are no user contributed notes for this page. Other Basic Extensions. GeoIP; FANN;JSON; Judy; Lua; Misc. Parsekit; SPL; SPL Types; Streams

  • APIs are all about integration between systems and sometimes the choice of data format
    will be dictated by whatever is on the other end of the relationship. XML is particularly
    popular among many enterprise technology platforms such as Java, Oracle, and .NET,





  • JSON with PHP - Tutorials for Sqoop, ITIL, Jackson ...

    This tutorial will teach you how to encode and decode JSON objects using PHPprogramming language. Let's start with preparing environment to start our programming ...
  • Introduction to JSON and PHP - ITNewb: Your Source to ...

    So you've heard the fanfare over JSON, but still haven't had the opportunity to dive into using it. Well, as a matter of fact, you may have been using JSON all along ...
  • PHP: JSON Functions - Manual - PHP: Hypertext …

    Two pure-php implementations of the json protocol that might be of use, e.g. for php 4 installs where adding extensions is not an option or because of extra ...
  • JSON Tutorial - W3Schools Online Web Tutorials

    JSON: JavaScript Object Notation. JSON is a syntax for storing and exchanging data.JSON is an easier to use alternative to XML.
  • PECL :: Package :: json - PECL :: The PHP Extension ...

    This package has been superseded, but is still maintained for bugs and security fixes. Package has moved to channel http://www.php.net/json, package json.
  • How To Parse JSON With PHP - WebDevTutsDepot — …

    Parsing a JSON file or string is just as easy as parsing XML once you get the syntax, and in this tutorial I’ll show you how to parse and learn its syntax.
  • PHP JSON installation and json_decode() function | JSON 

    In this page you will learn about installing JSON in PHP and about PHP json_decode() function with real world examples.
  • AJAX, JSON, jQuery, and PHP - Stack Overflow

    I know there are alot of different questions about this but none
    of them seem to pertain to me. I have an ajax request as follows: var responsePacket; $.ajax ...
  • Working with JSON in PHP jQuery | Packt

    Working with JSON in PHP jQuery written by Vijay Joshi: one of the many articles from Packt Publishing

  • 1. SimpleXMLis the most approachable, and my
     personal favorite. It is easy to use and understand,
     is well documented, and provides a simple interface
     as the namesuggests for getting the job done.
    SimpleXML does have some limitations, but it
    is recommended for most applications.

    2. DOM is handy when a project encounters some
    of the limitations in SimpleXML.It’s more powerful
    and therefore more complicated to use, but there are a small
    number of operations that can’t be done with
     SimpleXML. There are built-in func‐tions to allow
     conversion between these two formats, so it’s very common to use