dta38159 2012-09-14 19:20
浏览 40
已采纳

PHP包中的“机器字节顺序”是什么意思? [关闭]

I understand little & big endian, but What's "machine byte order" mean?

  • 写回答

1条回答 默认 最新

  • duandazhen7306 2012-09-14 19:26
    关注

    In pack the phrase "machine byte order" means that the endianess is determined by the current machine1

    PHP itself makes no guarantees as to which endianness such characters (e.g. S, L) encode data, except as the ordering relates to the current machine.

    Therefor, be cautious with using "machine byte order" pack characters and consider the guaranteed-order counter-parts (e.g. n, v) if there is every any doubt1. However, pay attention to the target data specification as some silly formats like [Microsoft] UUIDs are laid out in terms of "machine byte order" while others are always big-endian or always little-endian.


    1 x86/x64 is always little-endian, but PHP could technically run on big-endian machines .. somewhere. It is best to get into the habit of being explicit and precise to avoid having code suddenly and mysteriously "stop working" later on.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目