[email protected] has copied the code of [email protected]
But it is not correct.
The right version is here:
<?php
function ftok ($filePath, $projectId) {
$fileStats = stat($filePath);
if (!$fileStats) {
return -1;
}
return sprintf('%u',
($fileStats['ino'] & 0xffff) | (($fileStats['dev'] & 0xff) << 16) | ((ord($projectId) & 0xff) << 24)
);
}
?>
The difference is that $projectId string should be used as ASCII value via ord() function. Otherwise it will be interpreted as 0.