Unused local variable 'hash'

The value of the variable $hash obtained by
$hash = hash('sha256', $hashThis);
is overwritten immediately with one of the following
$hash = sha1($hashThis);
or
$hash = md5($hashThis);
but in both cases it is overwritten.

I suppose that the original idea of the developer was to try sha1() only when hash() is not available, and md5() only when sha1() is not available.