note 95618 deleted from mysqli-stmt.bind-param by danbrown
| From: | danbrown@php.net | Date: | Wed, 13 Jan 2010 15:52:18 +0000 |
| Subject: | note 95618 deleted from mysqli-stmt.bind-param by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164923@lists.php.net to get a copy of this message | ||
Note Submitter: dizelgenerator at gmail dot com
----
It is not necessary for variables to be force passed by reference to "bind_param()" when
calling it with "call_user_func_array()", as mark at x2software dot net and jette at
nerdgirl dot dk written below:
<?php
$params = array($var1, $var2);
$bind = array();
foreach ($params as $bindParam) {
$bind[] = &$bindParam;
}
call_user_func_array(array($this, 'bind_param'), $bind);
?>
This code is equivalent to:
<?php
$stmt->bind_param(&$var1, &$var2);
?>
This form of passing variables by reference is deprecated (see http://php.net/manual/en/language.references.pass.php).
It's better to write:
<?php
$params = array($var1, $var2);
call_user_func_array(array($this, 'bind_param'), $params);
?>