title: Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\lr\lr.php
body: <p>I am trying to sanitize all the data of array <code>$register_data</code> . For that I am using <code>array_walk()</code> in which I am passing the second parameter as the sanitize function, but I am getting this warning :</p>
  
  <blockquote>
    <p>Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, string given in C:\xampp..</p>
  </blockquote>
  
  <p>Below is my code:</p>
  
  <pre><code>function register_user($register_data) {
      array_walk($register_data, 'array_sanitize');
      $register_data['password'] = md5($register_data['password']);
      print_r($register_data);
  }
  
  function array_sanitize($conn, &amp;$item) {
      $item = mysqli_real_escape_string($conn, $item);
  }
  
  $conn = mysqli_connect($servername, $username, $password, $database);
  if(!$conn) {
      die();
  }
  </code></pre>