title: PHP Logonhours format
body: <p>I'm trying to set logonhours for ldap users using php. I've gotten to the point where I've created a GUI that looks like active directories with blue and grey cells representing allowed and denied logon hours. My problem is intermittently I receive "Server unwilling to perform" and I think it has something to do with my <strong>pack("C", bindec(strrev($chunk)))</strong> nested in a foreach loop that isn't spitting out the correct format. Is there something I should tack on to the <strong>pack("C", bindec(strrev($chunk)))</strong> statement to ensure it's always in the right format for my DC to accept it? </p>
  
  <pre><code>if (isset($_POST['logonhours'])){
  $set_logonhours = $_POST['logonhours'];
  $set_logonhours_end = mb_substr($set_logonhours, -5); // EST TIMEZONE
  $set_logonhours_begin = mb_substr($set_logonhours, 0, -5); // EST TIMEZONE
  $set_logonhours_tz = $set_logonhours_end . $set_logonhours_begin; 
  
  $set_eighthourchunks = str_split($set_logonhours_tz, 8);
  
  
  foreach ($set_eighthourchunks as $chunk){
  $logondec = pack("C", bindec(strrev($chunk))); //inconsistently works sometimes
  }
  echo $logondec;
  $adldap-&gt;user()-&gt;modify($_POST['username'], array("logonhours"=&gt;$logondec));
  
  
  echo '&lt;br&gt;';
  echo ldap_error($adldap-&gt;getLdapConnection()) . '&lt;br&gt;';
  }
  </code></pre>