Page 1 of 1

preg_replace for values in array

Posted: Thu Aug 09, 2007 10:17 am
by smilesmita
hi there,
i have an array which looks like this:
Array
(
[0_0_0_0_VALUE] => Test XML
[0_0_0_0_TAG] => CUSTOMERCONTEXT
[0_0_0_1_VALUE] => 1.0007
[0_0_0_1_TAG] => XPCIVERSION
[0_0_0_TAG] => TRANSACTIONREFERENCE
[0_0_1_VALUE] => 1
[0_0_1_TAG] => RESPONSESTATUSCODE
[0_0_2_VALUE] => Success
[0_0_2_TAG] => RESPONSESTATUSDESCRIPTION
[0_0_TAG] => RESPONSE
[0_1_0_VALUE] => smita_b
[0_1_0_TAG] => SUBSCRIBERID
[0_1_1_0_VALUE] => Alternate Billing
[0_1_1_0_TAG] => NAME
[0_1_1_1_VALUE] => 82C0E7922B3BA32B
[0_1_1_1_TAG] => NUMBER
[0_1_1_2_0_VALUE] => A
[0_1_1_2_0_TAG] => CODE
[0_1_1_2_1_VALUE] => Active
[0_1_1_2_1_TAG] => DESCRIPTION
[0_1_1_2_TAG] => SUBSCRIPTIONSTATUS
[0_1_1_3_0_VALUE] => 070801_151740001
)

I wanted to have some preg_replace pattern which would get me an even output like this :( i would like to just keep the words "tag " and "value" in the array key field instead of the numbers"
Array
(
[VALUE] => Test XML
[TAG] => CUSTOMERCONTEXT
[VALUE] => 1.0007
[TAG] => XPCIVERSION
......so on and so forth...

Please help.

-smita

Posted: Thu Aug 09, 2007 12:03 pm
by superdezign
I don't think it's possible to have an array with more than one key having the same name.