-
-
Save hakre/5c233e5dbf42618ebe9e to your computer and use it in GitHub Desktop.
Code-Documentation for http://stackoverflow.com/q/5462305/367456
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
### CC-BY 3.0 - copyright (c) 2007 Carmen Lehstl ### | |
function gzInflateData($data){ | |
if(substr($data,0,3)=="\37\213\10"){ | |
$start=10; | |
$flag=ord(substr($data,3,1)); | |
if($flag>0){ | |
if($flag&4){ | |
list($len)=unpack('v',substr($data,$start,2)); | |
$start=$start+2+$len; | |
} | |
if($flag&8) $start=strpos($data,"\0",$start)+1; | |
if($flag&16) $start=strpos($data,"\0",$start)+1; | |
if($flag&2) $start=$start+2; | |
} | |
return gzinflate(substr($data,$start,-8)); | |
} | |
else return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment