PHP 8.5.0 Alpha 1 available for testing

Voting

: five minus two?
(Example: nine)

The Note You're Voting On

seelts at gmail dot com
10 years ago
[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.

<< Back to user notes page

To Top