3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $parameters=array(); $parameters[0] = 'UPDATE applications SET service=?,acronym=?,email=? WHERE id=2'; $parameters[1] = '"value1","value2","value3"'; $query = array_shift($parameters); $parameter_array = explode(",",$parameters[0]); foreach ($parameter_array as $key => $a_parameter) { $parameter_array[$key] = trim($a_parameter, '"'); } //$statement = $db->prepare($query); echo "The query is:".$query."\n"; //try // { // $statement->execute($parameter_array); print_r($parameter_array); // } //catch (PDOException $error) //{ // echo $error -> getMessage(); //} ?>
Output for 4.3.0 - 7.1.0
The query is:UPDATE applications SET service=?,acronym=?,email=? WHERE id=2 Array ( [0] => value1 [1] => value2 [2] => value3 )