|
Posted by opensourcearts on 01/03/08 04:18
On Jan 2, 3:23 pm, NC <n...@iname.com> wrote:
> On Jan 2, 1:18 pm, opensourcea...@gmail.com wrote:
>
>
>
> > hash_file means something new in php5,
>
> Er, no. Effective PHP 5.1.2, there is a built-in function
> hash_file():
>
> http://www.php.net/hash_file
>
> > For now, the error that I get with the above code is just:
>
> > PHP Fatal error: Cannot redeclare hash_file()
>
> And you should, as you cannot define a function that already exists.
>
> > Is there some way to rewrite the above code
>
> Why bother? Just use the built-in hash_file() function. To see which
> hashing algorithms are supported on your system, call hash_algos():
>
> http://www.php.net/hash_algos
>
> Cheers,
> NC
Hello there and thanks,
But I am still at a loss as to what to do.
hash_file served a purpose in the php4 code below, but now it is an
official function in php5, so the below code no longer works. any
help owuld be great!
function hash_file ($strFilename) {
$n = 0;
for ($posFilename = strlen($strFilename) -1; $posFilename >= 0;
$posFilename-- ) {
$n *= 2;
if ($n & 4096) { $n |= 1; }
$n ^= (ord($strFilename[$posFilename])*11);
$n &= 4095;
}
return sprintf ("%02o/%02o", ($n/64) & 63 , $n&63);
}
For now, the error that I get with the above code is just:
PHP Fatal error: Cannot redeclare hash_file()
Is there some way to rewrite the above code, or something to
substitute for hash_file? Thanks!
Any insight would be great! I'd be willing to paypal someone. :)
How would your rewrite the above code?
Thanks!
Navigation:
[Reply to this message]
|