HMAC PHP output not matching with one in Java - Urgent : I'm trying to set up an API Connection which requires HMAC and encryption.
The documentation and sample output / code given to me is in Java but my website is in PHP. I'm on PHP 7.
What should I do so that my php output matches with that in Java sample output given in the API documentation.

I have tried to base64, utf8 and utf16 encoding on my php hmac output but still the value is not matching

PHP Code: 
$sb = '4a275929e0eba4445bc7f9a80c6361a2351119a27b51eebb2c259f68f72efd5f';
$keyToEncode = 'c0814229c201ab1022070741d15eda7af2189db64a2c88699c6481dbb83521afd8640d9af6d984602037d2e4f90c4f9a12915899290d944f385192b658829ec1;
$sb3 = hash_hmac('sha256',$sb, $keyToEncode);


Java Code: 
  **HMAC_SHA256(sb.toString(), keyToEncode);** 

Output in PHP:
**2bea1f99897a8fd2e836e9d8f7820a28c03b76bf37daf04527f6f5d279c97fd7**

Expected output in Java:
**gWzlCNzu7fNN4z/uwvrgk574dTJqLQ8+25UMXCh+4tU=**

