3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $links = array( 0 => array('productlink' => '/14/asic-company-reports', 'iconclass' => 'icon-picons-paper-2 icn'), 1 => array('productlink' => '/4/credit-and-bankruptcy', 'iconclass' => 'icon-picons-credit-card icn'), 2 => array('productlink' => '/1/business-intelligence', 'iconclass' => 'icon-picons-phone-book-2 icn'), 3 => array('productlink' => '/buy/42/apply-for-a-business-name#/step1', 'iconclass' => 'icon-picons-writing icn'), 4 => array('productlink' => '/19/asic-edge', 'iconclass' => 'icon-picons-documents-box icn'), 5 => array('productlink' => '/20/execucheck', 'iconclass' => 'icon-picons-user icn'), 6 => array('productlink' => '/buy/240/national-bankruptcy-extract', 'iconclass' => 'icon-picons-dollar icn'), 7 => array('productlink' => '/knowledgebase/4/landdata.html', 'iconclass' => 'icon-picons-location icn'), 8 => array('productlink' => '/17/policecheck', 'iconclass' => 'icon-picons-cv3 icn'), 9 => array('productlink' => '/18/PropertyReport', 'iconclass' => 'icon-picons-home-2 icn'), 10 => array('productlink' => '/3/personal-property', 'iconclass' => 'icon-picons-paper icn'), 11 => array('productlink' => '/15/vehicle-reports', 'iconclass' => 'icon-picons-car icn'), 12 => array('productlink' => '/domainchecker.php', 'iconclass' => 'icon-picons-laptop-web icn'), 13 => array('productlink' => '/5/web-services-centre', 'iconclass' => 'icon-picons-cloud-synce icn'), ); $words = array( 0 => array('title' => '/14/asic-company-reports', 'article' => 'icon-picons-paper-2 icn'), 1 => array('title' => '/4/credit-and-bankruptcy', 'article' => 'icon-picons-credit-card icn'), 2 => array('title' => '/1/business-intelligence', 'article' => 'icon-picons-phone-book-2 icn'), 3 => array('title' => '/buy/42/apply-for-a-business-name#/step1', 'article' => 'icon-picons-writing icn'), 4 => array('title' => '/19/asic-edge', 'article' => 'icon-picons-documents-box icn'), 5 => array('title' => '/20/execucheck', 'article' => 'icon-picons-user icn'), 6 => array('title' => '/buy/240/national-bankruptcy-extract', 'article' => 'icon-picons-dollar icn'), 7 => array('title' => '/knowledgebase/4/landdata.html', 'article' => 'icon-picons-location icn'), 8 => array('title' => '/17/policecheck', 'article' => 'icon-picons-cv3 icn'), 9 => array('title' => '/18/PropertyReport', 'article' => 'icon-picons-home-2 icn'), 10 => array('title' => '/3/personal-property', 'article' => 'icon-picons-paper icn'), 11 => array('title' => '/15/vehicle-reports', 'article' => 'icon-picons-car icn'), 12 => array('title' => '/domainchecker.php', 'article' => 'icon-picons-laptop-web icn'), 13 => array('title' => '/5/web-services-centre', 'article' => 'icon-picons-cloud-synce icn'), ); $count =0; $cart= array(); foreach ($words as $word) { $cart[$count] = array('title' => $word['title'], 'article' => $word['article'] ); $count++; } //var_dump($words); // after //var_dump($links); // after var_dump($cart); // after ?>
based on LAcKh
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(14) { [0]=> array(2) { ["title"]=> string(24) "/14/asic-company-reports" ["article"]=> string(23) "icon-picons-paper-2 icn" } [1]=> array(2) { ["title"]=> string(24) "/4/credit-and-bankruptcy" ["article"]=> string(27) "icon-picons-credit-card icn" } [2]=> array(2) { ["title"]=> string(24) "/1/business-intelligence" ["article"]=> string(28) "icon-picons-phone-book-2 icn" } [3]=> array(2) { ["title"]=> string(40) "/buy/42/apply-for-a-business-name#/step1" ["article"]=> string(23) "icon-picons-writing icn" } [4]=> array(2) { ["title"]=> string(13) "/19/asic-edge" ["article"]=> string(29) "icon-picons-documents-box icn" } [5]=> array(2) { ["title"]=> string(14) "/20/execucheck" ["article"]=> string(20) "icon-picons-user icn" } [6]=> array(2) { ["title"]=> string(36) "/buy/240/national-bankruptcy-extract" ["article"]=> string(22) "icon-picons-dollar icn" } [7]=> array(2) { ["title"]=> string(30) "/knowledgebase/4/landdata.html" ["article"]=> string(24) "icon-picons-location icn" } [8]=> array(2) { ["title"]=> string(15) "/17/policecheck" ["article"]=> string(19) "icon-picons-cv3 icn" } [9]=> array(2) { ["title"]=> string(18) "/18/PropertyReport" ["article"]=> string(22) "icon-picons-home-2 icn" } [10]=> array(2) { ["title"]=> string(20) "/3/personal-property" ["article"]=> string(21) "icon-picons-paper icn" } [11]=> array(2) { ["title"]=> string(19) "/15/vehicle-reports" ["article"]=> string(19) "icon-picons-car icn" } [12]=> array(2) { ["title"]=> string(18) "/domainchecker.php" ["article"]=> string(26) "icon-picons-laptop-web icn" } [13]=> array(2) { ["title"]=> string(22) "/5/web-services-centre" ["article"]=> string(27) "icon-picons-cloud-synce icn" } }