Upon being motivated by a “PHP style critique” discussion at the WebDeveloper.com forums, I dug around the manual page for mysqli_stmt::bind_result(), and noticed an interesting suggestion for the use of the call_user_func_array() function in combination with the bind_result() method (see the user note by “hamidhossain”).
The essence of the technique is to use call_user_func_array() to call the bind_param() method, supplying the list of variables to be bound via an array which has its elements defined as references to the actual variables you want bound. In the following example, I’m referencing them to a class variable named $data which is an associative array where the keys are the field names for the database table being operated upon.
(more…)
