3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function NVPToArray($NVPString) { $proArray = array(); while(strlen($NVPString)) { // name $keypos= strpos($NVPString,'='); $keyval = substr($NVPString,0,$keypos); // value $valuepos = strpos($NVPString,'&') ? strpos($NVPString,'&'): strlen($NVPString); $valval = substr($NVPString,$keypos+1,$valuepos-$keypos-1); // decoding the respose $proArray[$keyval] = urldecode($valval); $NVPString = substr($NVPString,$valuepos+1,strlen($NVPString)); } return $proArray; } $array = NVPToArray("BUTTONSOURCE[18]=AngellEYE_PHPClass&VERBOSITY[4]=HIGH"); print_r($array);
based on GeWQt
Output for 4.3.0 - 7.1.0
Array ( [BUTTONSOURCE[18]] => AngellEYE_PHPClass [VERBOSITY[4]] => HIGH )