execute v1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<?php
$str = 'SELECT * FROM `table` WHERE `name` = ? AND `id` = ?';
$values = array('abler98', 1);
$count = substr_count($str, '?');
if ($count > 0) {
for ($i = 0; $i < $count; ++$i) {
$pos = strpos($str, '?');
$str = substr_replace($str, $values[$i], $pos, 1);
}
}
echo $str.'<br />'; // SELECT * FROM `table` WHERE `name` = abler98 AND `id` = 1