update page now
PHP 8.4.20 Released!

Voting

: min(eight, five)?
(Example: nine)

The Note You're Voting On

seelts at gmail dot com
11 years ago
abk@avatartechnology.com has copied the code of daniele_dll@yahoo.it
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