3v4l.org

run code in 300+ PHP versions simultaneously
<?php $id =1; $SocialHandle = "Facebook,Twitter,LinkIn"; $SocialHandle = explode(",", $SocialHandle); $SociaUrl = "Url1,Url2,Url3"; $SociaUrl = explode(",", $SociaUrl); $sql = "INSERT INTO `social_table`(`id`, `social_handle`, `handle_url`) VALUES"; for ($i = 0; $i < count($SocialHandle); $i++) { $sql .= "($id, '$SocialHandle[$i]','$SociaUrl[$i]'),"; } $sql = rtrim($sql, ','); echo $sql;

preferences:
23.67 ms | 405 KiB | 5 Q