位置: 编程技术 - 正文

PHP:pack()的用法_misc函数(php pack)

编辑:rootadmin
pack

推荐整理分享PHP:pack()的用法_misc函数(php pack),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php pack函数,php msgpack,php package,php msgpack,php pack unpack,php pack函数,php package,php pack函数,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4, PHP 5)

pack — Pack data into binary string

说明 string pack ( string $format [, mixed $args [, mixed $... ]] )

Pack given arguments into a binary string according to format.

The idea for this function was taken from Perl and all formatting codes work the same as in Perl. However, there are some formatting codes that are missing such as Perl&#;s "u" format code.

Note that the distinction between signed and unsigned values only affects the function unpack(), where as function pack() gives the same result for signed and unsigned format codes.

参数

format

The format string consists of format codes followed by an optional repeater argument. The repeater argument can be either an integer value or * for repeating to the end of the input data. For a, A, h, H the repeat count specifies how many characters of one data argument are taken, for @ it is the absolute position where to put the next data, for everything else the repeat count specifies how many data arguments are consumed and packed into the resulting binary string.

Currently implemented formats are: pack() format characters Code Description a NUL-padded string A SPACE-padded string h Hex string, low nibble first H Hex string, high nibble first csigned char C unsigned char s signed short (always bit, machine byte order) S unsigned short (always bit, machine byte order) n unsigned short (always bit, big endian byte order) v unsigned short (always bit, little endian byte order) i signed integer (machine dependent size and byte order) I unsigned integer (machine dependent size and byte order) l signed long (always bit, machine byte order) L unsigned long (always bit, machine byte order) N unsigned long (always bit, big endian byte order) V unsigned long (always bit, little endian byte order) f float (machine dependent size and representation) d double (machine dependent size and representation) x NUL byte X Back up one byte Z NUL-padded string (new in PHP 5.5) @ NUL-fill to absolute position

args PHP:pack()的用法_misc函数(php pack)

返回值

Returns a binary string containing data.

更新日志

版本 说明 5.5.0 The "Z" code was added with equivalent functionality to "a" for Perl compatibility.

范例

Example #1 pack() example

<?php$binarydata=pack("nvc*",0x,0x,,);?>

The resulting binary string will be 6 bytes long and contain the byte sequence 0x, 0x, 0x, 0x, 0x, 0x.

注释 Caution

Note that PHP internally stores integer values as signed values of a machine-dependent size (C type long). Integer literals and operations that yield numbers outside the bounds of the integer type will be stored as float. When packing these floats as integers, they are first cast into the integer type. This may or may not result in the desired byte pattern.

The most relevant case is when packing unsigned numbers that would be representable with the integer type if it were unsigned. In systems where the integer type has a -bit size, the cast usually results in the same byte pattern as if the integer were unsigned (although this relies on implementation-defined unsigned to signed conversions, as per the C standard). In systems where the integer type has -bit size, the float most likely does not have a mantissa large enough to hold the value without loss of precision. If those systems also have a native -bit C int type (most UNIX-like systems don&#;t), the only way to use the I pack format in the upper range is to create integer negative values with the same byte representation as the desired unsigned value.

参见

unpack() - Unpack data from binary string

PHP:highlight_file()的用法_misc函数 highlight_file(PHP4,PHP5)highlight_file语法高亮一个文件说明mixedhighlight_file(string$filename[,bool$return=false])使用PHP内置的语法高亮器所定义的颜色,打印输出或者返

PHP:eval()的用法_misc函数 eval(PHP4,PHP5)eval把字符串作为PHP代码执行说明mixedeval(string$code)把字符串code作为PHP代码执行。CautionTheeval()languageconstructisverydangerousbecauseitallowsexecutionofarbitr

PHP:ignore_user_abort()的用法_misc函数 ignore_user_abort(PHP4,PHP5)ignore_user_abort设置客户端断开连接时是否中断脚本的执行说明intignore_user_abort([string$value])设置客户端断开连接时是否中断脚本的执

标签: php pack

本文链接地址:https://www.jiuchutong.com/biancheng/280632.html 转载请保留说明!

上一篇:PHP:php_check_syntax()的用法_misc函数

下一篇:PHP:highlight_file()的用法_misc函数

  • 商品流通企业税种有哪些
  • 离岸价的含义
  • 进项税额抵扣计算
  • 运输货车折旧计算公式
  • 高新企业申报指南
  • 营业收入与利润变化图
  • 销项发票能不能留抵
  • 附加税费申报没有怎么填
  • 住宿发票税点为什么有6%和3%的区别
  • 会计账簿账目核对要求包括哪些
  • 溢价发行可转换公司债券会计分录例题
  • 企业收到非金融机构利息收入怎么做账务处理
  • 购入但未开始使用的房产
  • 股权收购的好处
  • 进项税发票认证流程
  • 增值税一般纳税人认定标准
  • 汇算清缴后如何进行调帐处理
  • 利息 财务费用
  • 企业报税网上申报好了怎么导入
  • 公司入职员工
  • 城市维护建设税属于什么税种
  • 购买基金会计核算
  • 不动产进项税为什么不能抵扣
  • cmos电池耗尽
  • 固定资产不入账的后果
  • 微商行业代理奖金如何入账
  • 职工食堂的费用,会计上怎么做账?
  • 事业单位基建账并入大账规定
  • linux的命令行指的是什么
  • adb命令linux命令的区别
  • win10商店无法加载
  • 固定资产抵债交不交增值税
  • 车间闲置固定资产怎么算
  • wordpress怎么搜索域名
  • nkvmon.exe - nkvmon是什么进程 有什么用
  • 营改增后,个人转让房屋的个人所得税
  • print-js
  • 应收账款转让的限制约定
  • 伊吕波赛道
  • 企业向个人提供咨询服务
  • 债券利息调整怎样计算
  • 实收资本增加印花税申报流程
  • vue element ui
  • 玻璃深加工企业排名
  • vue笔记项目
  • 开公司车出差违章了谁负责
  • 进货退出进项税额的核算
  • 小规模纳税人财务报表是按季还是按月申报
  • springbootredis密码加密
  • sql中drop的用法
  • sqlserver2012安装好了桌面没有图标
  • 差旅费需要缴纳增值税吗
  • 企业累计预扣个税是什么
  • 股权转让所得如何申报个税
  • 扣非净利润为什么比净利润高
  • 控制成本的优点
  • 租来设备本身原因致人损害
  • 业务招待费算期间费用吗
  • 转账手续费怎么入账
  • 计入福利费
  • 自行研发的无形资产入账价值
  • 收到投资款怎么做凭证
  • mysql数据库sid
  • win8 开机
  • cool file viewer pro是什么软件
  • win8系统一直重启
  • win10怎么安装运行库
  • centos6 docker
  • win8 设置
  • win7不重装修复系统
  • win8系统启动不了如何修复
  • linux 指定动态库连接位置
  • 批处理命令教程 pdf
  • css判断语句
  • opengl实现光线追踪
  • AngularJS中controller控制器继承的使用方法
  • js多选
  • 实现 java
  • 投资联营的房产税纳税人是谁
  • 复印店开什么发票
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设