public static function reverseIfLittleEndian($toCheck)
    {
        // Little endian, needs to be reversed
        if (unpack('S',"\x01\x00")[1] === 1)
        {
            // Reverse an array
            if (is_array($toCheck))
            {
                return array_reverse($toCheck);
            }

            // Reverse a string
            else
            {
                return strrev($toCheck);
            }
        }

        // Big endian, no need to reverse
        else
        {
            return $toCheck;
        }
    }
public static function reverseIfLittleEndian($toCheck)
    {
        // Little endian, needs to be reversed
        if (unpack('S',"\x01\x00")[1] === 1)
        {
            // Reverse an array
            if (is_array($toCheck))
            {
                return array_reverse($toCheck);
            }

            // Reverse a string
            else
            {
                return strrev($toCheck);
            }
        }

        // Big endian, no need to reverse
        else
        {
            return $toCheck;
        }
    }
public static function reverseIfLittleEndian ( $ toCheck ) { // Little endian, needs to be reversed if ( unpack ( 'S' , "\x01\x00" ) [ 1 ] === 1 ) { // Reverse an array if ( is_array ( $ toCheck ) ) { return array_reverse ( $ toCheck ) ; } // Reverse a string else { return strrev ( $ toCheck ) ; } } // Big endian, no need to reverse else { return $ toCheck ; } }
Reverses an array or string if the system is little endian.

@param $toCheck array|string The array/string;
@return array|string The original array/string if on a big endian system, otherwise a reversed version.
Reverses an array or string if the system is little endian .