user89973: From How can I make this PHP merkle root script recursive?
function binFlipByteOrder($string) {
    return implode('', array_reverse(str_split($string, 1)));
}

Why a flip?

user60443: Hashes are big endian by standard, and most computers use little endian, so it's probably just for convenience. See Why does the Bitcoin protocol use the little-endian notation?

89973: <p>From <a href="https://bitcoin.stackexchange.com/questions/43565/how-can-i-make-this-php-merkle-root-script-recursive">How can I make this PHP merkle root script recursive?</a></p>

<pre><code>function binFlipByteOrder($string) {
    return implode('', array_reverse(str_split($string, 1)));
}
</code></pre>

<p>Why a flip?</p>
 60443: <p>Hashes are big endian by standard, and most computers use little endian, so it's probably just for convenience. See <a href="https://bitcoin.stackexchange.com/questions/2063/why-does-the-bitcoin-protocol-use-the-little-endian-notation">Why does the Bitcoin protocol use the little-endian notation?</a></p>
