2017 © Pedro Peláez
 

library xml2array

This will convert a Simple XML string to a associative array.

image

frankperez87/xml2array

This will convert a Simple XML string to a associative array.

  • Sunday, January 4, 2015
  • by frankperez87
  • Repository
  • 1 Watchers
  • 0 Stars
  • 261 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

Easy XML to Array Conversion

This package allows you to easily convert a xml string to a associative array., (*1)

Example Usage


        <urlset>
            <url>
                <loc>http://www.google.com</loc>
                <changefreq>monthly</changefreq>
                <priority>1</priority>
            </url>
            <url>
                <loc>http://www.yahoo.com</loc>
                <changefreq>monthly</changefreq>
                <priority>1</priority>
            </url>
            <url>
                <loc>http://www.bing.com</loc>
                <changefreq>monthly</changefreq>
                <priority>1</priority>
            </url>
        </urlset>';


// Pass in XML String
$parser = new XML2Array\Parser($xml);

// Convert  XML to Associative Array
$output = $parser->toArray();

// Print out results
print '

';
print_r($output);
print '
';

Example Output

Array
(
    [url] => Array
        (
            [0] => Array
                (
                    [loc] => http://www.google.com
                    [changefreq] => monthly
                    [priority] => 1
                )

            [1] => Array
                (
                    [loc] => http://www.yahoo.com
                    [changefreq] => monthly
                    [priority] => 1
                )

            [2] => Array
                (
                    [loc] => http://www.bing.com
                    [changefreq] => monthly
                    [priority] => 1
                )

        )

)

The Versions

04/01 2015

dev-master

9999999-dev

This will convert a Simple XML string to a associative array.

  Sources   Download

MIT

The Development Requires

04/01 2015

v1.0.0

1.0.0.0

This will convert a Simple XML string to a associative array.

  Sources   Download

MIT

The Development Requires