In C# I can get the endianness type by this code snippet:
if(BitConverter.IsLittleEndian)
{
// little-endian is used
}
else
{
// big-endian is used
}
How can I do the same in PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PHP’s string type is an 8-bit binary string, a
charsequence. It has no endianness. Thus for the most part endianness is a non-issue in PHP.If you need to prepare binary data in a specific endianness, use the
pack()andunpack()functions.If you need to determine the machine’s native endianness, you can use
pack()andunpack()in the same way.