title: How to passing an array to the bind_param method as an argument in oop
body: <p>When I want to pass an array to bind_param method, I get an error like the following.</p>
  
  <p>Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in C:\xampp\htdocs\mvc\libs\Database.php on line 26</p>
  
  <p>Here is code:</p>
  
  <pre><code>class Database extends mysqli {
  
      function __construct($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME) {
          parent::__construct($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
      }
  
      function insert($table, $data){
  
          echo $table . '&lt;br /&gt;';
          print_r($data);
          echo '&lt;br /&gt;';        
          $param_types=$this-&gt;gettypes_bind_param($data, $keys, $values, $place_holder);
          $field_names= implode(', ', $keys);
          $inputArray[]=&amp;$param_types;
          $j= count($values);
          for ($i=0;$i&lt;$j;$i++)
          {
              $inputArray[]=&amp;$values[$i];
          }
  
          print_r($inputArray); 
          echo '&lt;br /&gt;';
          $result= $this-&gt;prepare("INSERT INTO $table ($field_names) VALUES ($place_holder)");
          call_user_func_array(array($result, 'bind_param'), $inputArray);
          $result-&gt;execute();
          die;
      }
  
      function gettypes_bind_param(&amp;$data, &amp;$keys, &amp;$values, &amp;$place_holder){
          $types='';
          foreach ($data as $tmp)
          {
              switch (gettype($tmp))
              {
                  case "string" :
                      $types.='s';
                      break;
                  case "integer" :
                      $types.='i';
                      break;                
                  case "double" :
                      $types.='d';
                      break;                
                  default :
                      $types.='b';
                      break;                
              }
              $place_holder .='?, ';
          }
          $place_holder= rtrim($place_holder, ', ');
          $keys = array_keys($data);
          $values = array_values($data);
          return $types;
      }
  </code></pre>
  
  <p>Sorry, for my English</p>