Commit dcba3b76 authored by Carsten  Rose's avatar Carsten Rose
Browse files

BindParam: preparation for call_user_func

parent 7a129dad
<?php
/**
* Created by PhpStorm.
* User: nick9v at hotmail dot com ¶
* Date: 2/10/16
* Time: 2:05 PM
*/
namespace qfq;
class BindParam {
private $values = array(), $types = '';
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;
}
public function get() {
return array_merge(array($this->types), $this->values);
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment