Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Class BindParam
* @package qfq
*/
class BindParam {
/* */
private $values = array(), $types = '';
/**
* @param $value
*/
public function add(&$value) {
$this->values[] = &$value;
$this->types .= $this->getParameterBindType($value);
}
/**
* Depending of $value, returns i (integer), d (double) or s (string). This is needed for mysqli_bind().
*
* @param $value
*
* @return string
*/
private function getParameterBindType($value) {
if (is_int($value)) {
$type = 'i';
} elseif (is_double($value)) {
$type = 'd';
} else {
$type = 's';
}
return $type;
}
/**
* @return array
*/
public function get() {
return array_merge(array($this->types), $this->values);
}
}