- var_dump: documentation ( source)
- array_chunk: documentation ( source)
- preg_match_all: documentation ( source)
- preg_split: documentation ( source)
<?php
$s = "id[hi]=2&action=save&title=Corporate+Identity&short=identity&colour=%23ff751a&categoryID=1&bookURL=%2Ffiles%2Fbooks%2Fart_of_corporate_identity.pdf&bookImage=%2Ffiles%2Fimages%2Farticle-thumbs%2Fidentity.png&intro=%3Cp%3E%3Cbr+data-mce-bogus%3D%221%22%3E%3C%2Fp%3E§ion%5B%5D%5Btitle%5D=Your+current+identity§ion%5B%5D%5Bquestion%5D%5B%5D%5Btype%5D=5§ion%5B%5D%5Bquestion%5D%5B%5D%5Btext%5D=What's+going+on+here%3F§ion%5B%5D%5Bquestion%5D%5B%5D%5Boption%5D%5B%5D=This+is+option+1§ion%5B%5D%5Bquestion%5D%5B%5D%5Boption%5D%5B%5D=Option+2!§ion%5B%5D%5Bquestion%5D%5B%5D%5Boption%5D%5B%5D=And+number+3!§ion%5B%5D%5Bquestion%5D%5B%5D%5Btype%5D=1§ion%5B%5D%5Bquestion%5D%5B%5D%5Btext%5D=Hi§ion%5B%5D%5Bquestion%5D%5B%5D%5Btype%5D=1§ion%5B%5D%5Bquestion%5D%5B%5D%5Btext%5D=Hello§ion%5B%5D%5Btitle%5D=Identity+management§ion%5B%5D%5Btitle%5D=Brand+building§ion%5B%5D%5Btitle%5D=Recognition§ion%5B%5D%5Btitle%5D=Your+views+on+change§ion%5B%5D%5Btitle%5D=Developing+a+new+identity";
$p = array_chunk(preg_split('/[&=]/', $s), 2);
preg_match_all('/(\A[\[\]]*([^\[\]]+)\]*)/', "id[test]", $matches, PREG_OFFSET_CAPTURE);
echo var_dump($matches);