note 95618 added to mysqli-stmt.bind-param

From: Date: Tue, 12 Jan 2010 20:22:35 +0000
Subject: note 95618 added to mysqli-stmt.bind-param
Groups: php.notes 
Request: Send a blank email to php-notes+get-164890@lists.php.net to get a copy of this message
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); ?> ---- Server IP: 78.41.111.5 Probable Submitter: 95.27.91.129 ---- Manual Page -- http://www.php.net/manual/en/mysqli-stmt.bind-param.php Edit -- https://master.php.net/note/edit/95618 Del: integrated -- https://master.php.net/note/delete/95618/integrated Del: useless -- https://master.php.net/note/delete/95618/useless Del: bad code -- https://master.php.net/note/delete/95618/bad+code Del: spam -- https://master.php.net/note/delete/95618/spam Del: non-english -- https://master.php.net/note/delete/95618/non-english Del: in docs -- https://master.php.net/note/delete/95618/in+docs Del: other reasons-- https://master.php.net/note/delete/95618 Reject -- https://master.php.net/note/reject/95618 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164890) next »