title: ASP classic CLng function - convert to PHP
body: <p>I have an old site created with ASP classic and now I got up the courage to convert it to PHP. Must say I am NOT an expert in neither of this languages.</p>
  
  <p>There is a simple function that is driving me crazy. It uses CLng in a way I never seen before and I can't find a similar method in PHP.</p>
  
  <p>Here is the function in ASP classic:</p>
  
  <pre><code>Function TransferDecode(ByRef Source)
  Dim C, I, P, S, K
      C = Len(Source) / 2
      TransferDecode = ""
      For I = 0 to C - 1
          P = I * 2 + 1
          S = Mid(Source, P, 2)
          K = CLng("&amp;H" &amp; S)
          TransferDecode = TransferDecode &amp; Chr(K)
      Next
  End Function
  </code></pre>
  
  <p>And here is my (uncessefull) attempt to convert to PHP:</p>
  
  <pre><code>function transferDecode($source) {
      $r = '';
      $c = strlen($source) / 2;
      for ($i = 0; $i &lt;= $c - 1; $i++) {
          $p = $i * 2 + 1;
          $s = substr($source, $p, 2);
          $k = '&amp;H'.$s;
          $r .= chr((int)$k);
      }
      return $r;
  }
  </code></pre>
  
  <p>Please, can someone explain me what "CLng("&amp;H" &amp; S)" do? Is there a similar CLng method in PHP?</p>
  
  <p>Thank you!</p>