Introduction to PHP recursive JSON development examples

Source: Internet
Author: User
Tags php class
In our daily development work, something will encounter PHP recursive JSON, then we will introduce to you today PHP recursive JSON class code, parse the main function, parse the index array, parse the array of numbers, check whether an array is strictly numeric index.

First download the class library of PHP recursive JSON that we need to use for this lesson: http://www.php.cn/xiazai/leiku/561

After the download, find the PHP class files we need, unzip to our local directory, create a new PHP file!

Once this is done, we will invoke this class in the new PHP file, and instantiate the class:

<?phpinclude_once "json.php";//Introduce class file $ARR1 = Array ("website" = "php Chinese web", "url" = "www.php.cn");//define array $obj = new JSON ( $arr 1);          Instantiate echo "Parse main function:". $obj->mainarr (). " <br> ";//Parse main function echo" parse index array: ". $obj->indexarr ($arr 1)." <br> ";//Parse index array $arr2 = Array (" 123 "=" php Chinese "," 124 "=" www.php.cn ");//fixed to numeric index array echo" Parse array of numbers: ". $obj Numarr ($arr 2). " <br> ";//analytic array of numbers?>

Run the file and get the results as shown:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.