3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Everything you enter here will be executed by our servers. Try it! function get_in_sql($getdata){ if(is_array($getdata)) { $string = ""; if (count($getdata) == 1) { $string = $getdata[0]; } else { foreach ($getdata as $value) { if ($value === end($getdata)) { $string .= $value; } else { $string .= $value . ","; } } } return $string; } return $getdata; } $array = array('0'=>1); echo get_in_sql($array);
Output for 4.3.0 - 7.1.0
1