title: Updating user fields in Active Directory with ldap_mod_replace
body: <p>I am trying to update the mobile field for a user in Active Directory but I keep getting the following error. I have been trying to solve this for hours. It's probably something simple.</p>
  
  <blockquote>
    <p>Warning: ldap_mod_replace(): Modify: Invalid syntax in
    /var/www/php_builders/admin/user_update/user_update_action.php on line
    183</p>
  </blockquote>
  
  <p>When I output the array, the mobile number shows up. its not empty.</p>
  
  <pre><code>ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
  $adconn = ldap_connect("ldap://earth.example.com") or die("Couldn't connect to AD!");
  $set = ldap_set_option($adconn, LDAP_OPT_PROTOCOL_VERSION, 3);
  ldap_get_option($adconn, LDAP_OPT_PROTOCOL_VERSION, $value); 
  $DN = 'CN=itcoopadmin,CN=Users,DC=example,DC=com';
  $ldap_bind = ldap_bind($adconn, $DN, "**********");
  $dn = trim($_POST['dn']);
  $mobile = trim($_POST['mobile']);
  
  if(!empty($mobile)) {
      $AD_mobile = AD_format($mobile);
      $DB_mobile = DB_format($mobile);
      $attributes['mobile'] = $AD_mobile;
  } else {
      $DELETEattrs["mobile"] = array();
      $DELETEattrs = array();
  }
  
  
  $replace=ldap_mod_replace($adconn, $dn, $attributes); // Line 183, where the error is getting triggered
  
  $disconnect = ldap_unbind($adconn);
  </code></pre>