This article mainly introduces the usage of php dynamic variable binding, and involves the related skills of php variable determination and dynamic definition, for more information about how to use dynamic variable binding in php, see the example in this article. Share it with you for your reference. The details are as follows:
Private function bindVars ($ stmt, $ params) {if ($ params! = Null) {$ types = ''; // initial sting with types foreach ($ params as $ param) {// for each element, determine type and add if (is_int ($ param) {$ types. = 'I'; // integer} elseif (is_float ($ param) {$ types. = 'd'; // double} elseif (is_string ($ param) {$ types. ='s '; // string} else {$ types. = 'B'; // blob and unknown} $ bind_names [] = $ types; // first param needed is the type string // eg: 'isss' for ($ I = 0; $ I
I hope this article will help you with php programming.