Skip to content

Instantly share code, notes, and snippets.

@rafasashi
Created April 27, 2015 09:30
Show Gist options
  • Save rafasashi/df1fc420cdf0aaa46ca7 to your computer and use it in GitHub Desktop.
Save rafasashi/df1fc420cdf0aaa46ca7 to your computer and use it in GitHub Desktop.
custom ftok function for windows
function custom_ftok($pathname='', $proj=''){
$ftok=false;
if(function_exists('ftok')){
$ftok = ftok($pathname, $proj);
}
else{
$pathname = $pathname . (string) $proj;
for($key = array(); sizeof($key) < strlen($pathname); $key[] = ord(substr($pathname, sizeof($key), 1)));
$ftok = dechex(array_sum($key));
}
return $ftok;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment