3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $query1 = 'button_id798_number=798&button_id798_size=936&button_id798_price=0&button_id798_status=2&button_id799_number=799&button_id799_size=840&button_id799_price=0&button_id799_status=2&button_id800_number=800&button_id800_size=840&button_id800_price=329280'; $query2 = preg_replace('/_id(\d+)_(.+?)=/', '[$1][point_$2]=', $query1); parse_str($query2, $out); // better to be safe than sorry print '<pre>' ; var_dump($query2, $out['button']);
Output for 4.3.0 - 7.3.1
<pre>string(315) "button[798][point_number]=798&button[798][point_size]=936&button[798][point_price]=0&button[798][point_status]=2&button[799][point_number]=799&button[799][point_size]=840&button[799][point_price]=0&button[799][point_status]=2&button[800][point_number]=800&button[800][point_size]=840&button[800][point_price]=329280" array(3) { [798]=> array(4) { ["point_number"]=> string(3) "798" ["point_size"]=> string(3) "936" ["point_price"]=> string(1) "0" ["point_status"]=> string(1) "2" } [799]=> array(4) { ["point_number"]=> string(3) "799" ["point_size"]=> string(3) "840" ["point_price"]=> string(1) "0" ["point_status"]=> string(1) "2" } [800]=> array(3) { ["point_number"]=> string(3) "800" ["point_size"]=> string(3) "840" ["point_price"]=> string(6) "329280" } }