What is the PHP equivalent of this C# encoding code?
<p>I want to turn the following C# code into PHP.</p>

<p>The C# is:</p>

<pre><code>byte[] operation = UTF8Encoding.UTF8.GetBytes("getfaqs");
byte[] secret = UTF8Encoding.UTF8.GetBytes("Password");

var hmac = newHMACSHA256(secret);
byte[] hash = hmac.ComputeHash(operation);
</code></pre>

<p>Which I've turned into this:</p>

<pre><code>$hash = hash_hmac( "sha256", utf8_encode("getfaqs"), utf8_encode("Password"));
</code></pre>

<p>Then I have:</p>

<pre><code>var apiKey = "ABC-DEF1234";
var authInfo = apiKey + ":" + hash

//base64 encode the authorisation info
var authorisationHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(authInfo));
</code></pre>

<p>Which I think should be:</p>

<pre><code>$authInfo = base64_encode($apiKey . ":" . $hash);
</code></pre>

<p>Or</p>

<pre><code>$authInfo = base64_encode(utf8_encode($apiKey . ":" . $hash));
</code></pre>

<p>But not certain, notice this second encoding uses Encoding.UTF8, not UTF8Encoding.UTF8.</p>

<p>What should the PHP code look like?</p>
