3v4l.org

run code in 300+ PHP versions simultaneously
<?php $raw = <<< 'TEXT' FIRSTNAME=firstname NAME=lastname STREET=street adress CITY=cityname ZIP=zipcode COUNTRY=country ISOCOUNTRY=US EMAIL=email@domene.com MOBILENO=123456789 USERNO=somenumber [PRODUCT] QTY=2 ALPROJECTID=1123208 PRICE=134,00 DESCRIPTION=product1 ARTNO=1 [PRODUCT] QTY=1 ALPROJECTID=9563214 PRICE=64,00 DESCRIPTION=product2 ARTNO=2 TEXT; //replace [PRODUCT] with [PRODUCT_1], [PRODUCT_2]... $raw = preg_replace_callback( '/\[PRODUCT\]/', function() {static $i=0; return '[PRODUCT_'.$i++.']';} ,$raw, -1, $count); //parse string into an array $data = parse_ini_string($raw,true); //extract the products into their own array. This assumes that //[PRODUCT] sections are always at the end of the file $products = array_values(array_splice($data,$count*-1)); //Build the final array $data = $data + ['PRODUCTS'=>$products]; echo "There are $count products \n\n"; print_r($data);
Output for git.master, git.master_jit, rfc.property-hooks
There are 2 products Array ( [FIRSTNAME] => firstname [NAME] => lastname [STREET] => street adress [CITY] => cityname [ZIP] => zipcode [COUNTRY] => country [ISOCOUNTRY] => US [EMAIL] => email@domene.com [MOBILENO] => 123456789 [USERNO] => somenumber [PRODUCTS] => Array ( [0] => Array ( [QTY] => 2 [ALPROJECTID] => 1123208 [PRICE] => 134,00 [DESCRIPTION] => product1 [ARTNO] => 1 ) [1] => Array ( [QTY] => 1 [ALPROJECTID] => 9563214 [PRICE] => 64,00 [DESCRIPTION] => product2 [ARTNO] => 2 ) ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.88 ms | 403 KiB | 8 Q