3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $insert = ""; $array1 = array( '1' => array( 'prodid' => 1, 'title' => 'product one', 'amount' => 10 ), '2' => array( 'prodid' => 2, 'title' => 'product two', 'amount' => 10 ), '3' => array( 'prodid' => 3, 'title' => 'product three', 'amount' => 10 ) ); foreach ($array1 as $prodid => $data){ $insert .= "($prodid,'".$data['title']."',{$data['amount']}),"; } $insert = substr($insert,0,-1); echo $insert;
Output for 4.3.0 - 7.1.0
(1,'product one',10),(2,'product two',10),(3,'product three',10)