fork download
  1. <?php
  2.  
  3. $string="34=No,46=fgbfb,48=NA,29=NA,45=dsd,49=InConclusive,43=1BHK,35=NA,38=12,39=2,27=q1,41=Others,52=fgfdg,47=fgfg,31=Chawl,33=UpperMiddleClass,37=SelfOwned,30=fdgfdgb,50=fgfdgb,51=fgfdg,32=NA,44=[Refrigerator,Airconditioner]";
  4. preg_match_all('~\d+=(?:\[[^]]*]|[^,]*)~', $string, $results);
  5. print_r($results[0]);
Success #stdin #stdout 0.02s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 34=No
    [1] => 46=fgbfb
    [2] => 48=NA
    [3] => 29=NA
    [4] => 45=dsd
    [5] => 49=InConclusive
    [6] => 43=1BHK
    [7] => 35=NA
    [8] => 38=12
    [9] => 39=2
    [10] => 27=q1
    [11] => 41=Others
    [12] => 52=fgfdg
    [13] => 47=fgfg
    [14] => 31=Chawl
    [15] => 33=UpperMiddleClass
    [16] => 37=SelfOwned
    [17] => 30=fdgfdgb
    [18] => 50=fgfdgb
    [19] => 51=fgfdg
    [20] => 32=NA
    [21] => 44=[Refrigerator,Airconditioner]
)