function MPEGaudioHeaderValid($rawarray, $echoerrors = false, $allowBitrate15 = false)
 {
     if (($rawarray['synch'] & 0xffe) != 0xffe) {
         return false;
     }
     static $MPEGaudioVersionLookup;
     static $MPEGaudioLayerLookup;
     static $MPEGaudioBitrateLookup;
     static $MPEGaudioFrequencyLookup;
     static $MPEGaudioChannelModeLookup;
     static $MPEGaudioModeExtensionLookup;
     static $MPEGaudioEmphasisLookup;
     if (empty($MPEGaudioVersionLookup)) {
         $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray();
         $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray();
         $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray();
         $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray();
         $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray();
         $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray();
         $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray();
     }
     if (isset($MPEGaudioVersionLookup[$rawarray['version']])) {
         $decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']];
     } else {
         echo $echoerrors ? "\n" . 'invalid Version (' . $rawarray['version'] . ')' : '';
         return false;
     }
     if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) {
         $decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']];
     } else {
         echo $echoerrors ? "\n" . 'invalid Layer (' . $rawarray['layer'] . ')' : '';
         return false;
     }
     if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) {
         echo $echoerrors ? "\n" . 'invalid Bitrate (' . $rawarray['bitrate'] . ')' : '';
         if ($rawarray['bitrate'] == 15) {
             // known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0
             // let it go through here otherwise file will not be identified
             if (!$allowBitrate15) {
                 return false;
             }
         } else {
             return false;
         }
     }
     if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) {
         echo $echoerrors ? "\n" . 'invalid Frequency (' . $rawarray['sample_rate'] . ')' : '';
         return false;
     }
     if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) {
         echo $echoerrors ? "\n" . 'invalid ChannelMode (' . $rawarray['channelmode'] . ')' : '';
         return false;
     }
     if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) {
         echo $echoerrors ? "\n" . 'invalid Mode Extension (' . $rawarray['modeextension'] . ')' : '';
         return false;
     }
     if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) {
         echo $echoerrors ? "\n" . 'invalid Emphasis (' . $rawarray['emphasis'] . ')' : '';
         return false;
     }
     // These are just either set or not set, you can't mess that up :)
     // $rawarray['protection'];
     // $rawarray['padding'];
     // $rawarray['private'];
     // $rawarray['copyright'];
     // $rawarray['original'];
     return true;
 }