[ create a new paste ] login | about

Link: http://codepad.org/VTrRIWbV    [ raw code | output | fork ]

PHP, pasted on Dec 9:
1
2
3
4
5
6
7
<?php
$inside = "key\:1:value\;1;key2:value2;key3:value3;";                                                                                                                                                          
$pairs = preg_split('/(?<!\\\\);/',$inside,-1,PREG_SPLIT_NO_EMPTY );
foreach($pairs as $pair) {
        list($k,$v) = preg_split('/(?<!\\\\):/',$pair);
        printf("%10s\t%10s\n",$k,$v);
}


Output:
1
2
3
    key\:1	  value\;1
      key2	    value2
      key3	    value3


Create a new paste based on this one


Comments: