Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

recreate original php array from print r output using -'php,arrays,multidimensional-array,output'

recreate original php array from print r output  using -'php,arrays,multidimensional-array,output'

Let's say I have this output from some source where I don't have access to the original PHP created array:

    [products] => Array
            [name] => Arduino Nano Version 3.0 mit ATMEGA328P
            [id] => 10005

    [listings] => Array
            [category] =>
            [title] => This is the first line
This is the second line
            [subtitle] => This is the first subtitle
This is the second subtitle
            [price] => 24.95
            [quantity] =>
            [stock] =>
            [shipping_method] => Slow and cheap
            [condition] => New
            [defects] =>

    [table_count] => 2
    [tables] => Array
            [0] => products
            [1] => listings


Now I would like to input that data and have an algorithm recreate the original array that it was printing so I can then use it for my own application.

Currently I am thinking about a sub_str() and regex statements that pull data and place it appropriately. Before I head further, is there a simpler way, via already written code or php plugins that do this for me already out there?

asked Sep 8, 2015 by rajesh
0 votes

Related Hot Questions

Government Jobs Opening