PHP: Removing BOM(Binary Order Mark) from given string

The Binary OrderMark(BOM) is the hidden secret code used for securing the data transfer via REST services. Commonly this BOM details available starting of each string(Commonly exist in first 3 characters). But will saving in Database or processing we no need this code. So we can strip from actual code.

The below is the sample code of stripping BOM.

Sample Code: 

// The hexa value of hidden value is efbbbf.
if (strpos(bin2hex($string), 'efbbbf') === 0) {
   $string = substr($string, 3);