位置: 编程技术 - 正文

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函数

  • 捐赠税前扣除比例表
  • 个税抵扣夫妻双方只要一个人填写吗
  • 销售成本是负债吗
  • 员工报销没有发票怎么入账
  • 农药增值税减免政策
  • 进项税的现金流量项目
  • 跨境电商有进口吗
  • 开立基本账户所需资料
  • 劳务公司外地劳务是否需要预缴税款及会计处理
  • 未认证的进项税账务处理
  • 汽车贷款利息是什么
  • 员工考试报名费计入什么科目
  • 部门独立核算管理制度
  • 非独立核算的分公司是法人主体吗
  • 农户贷款免征增值税吗?
  • 资产总计与负债和所有者权益总计不一致
  • 个税前几个月没有工资,累计减除费用会累计吗
  • 火车票抵扣进项税需要认证吗
  • 公司不交增值税对法人有影响吗
  • 运费允许抵扣的税额分录
  • 电子申报是什么
  • 超市库存商品分为哪几类
  • 小企业财务入账的办公用品有什么?
  • 长期债权投资业务处理
  • 企业押金怎么管理
  • 基建工程施工单位罚款如何做账?
  • 如何创建一个空的dataframe
  • ps4运行windows
  • 发生利息收入的分录
  • 合作社实际没有自产自销,但税务方面怎么可以提供证明
  • 企业商誉高好还是低好
  • 贷款和应收款项应采用实际利率法
  • 如何计算企业年度人均产值
  • 消费赠送积分
  • 布鲁克斯岭
  • 科罗拉多州位置
  • 用土地抵账合法吗
  • 银行汇票和银行本票的区别
  • 工程的直接成本包括哪些
  • axios在vue中的使用慕课笔记
  • 财务处理的时候要做什么
  • 增值税专用发票查询系统官方网站
  • 微信php源码
  • 企业缴纳职工社保需要每月去社保局吗
  • 什么是企业年报 汇算 加计
  • 预收账款的销售分录
  • 工会经费能不能用于体检
  • 安装购买的材料怎么做账
  • 应收账款和应付账款属于什么科目
  • 实收资本账务处理流程
  • 煤炭资源税优惠政策
  • 利息收入缴纳税率怎么算
  • 建筑企业包工包料业务的发票开具和涉税处理
  • 主播收钱违法吗
  • 因产品质量问题造成的损失怎么赔偿
  • 扶贫差旅费
  • 其他债权投资发生减值会影响所有者权益总额吗
  • 小规模减半征收房产税文件
  • 分配间接成本的计算公式
  • 会计做假账的果报
  • sql server如何
  • win10系统即将过期怎么办
  • freebsd 安装
  • linux中mail命令
  • win8尝试修复
  • reminder.exe - reminder是什么进程 有什么用
  • winxp开启远程桌面连接
  • 搜集数据软件
  • Debian如何安装网卡驱动
  • opengl基础知识
  • 在微信支付宝借贷会影响征信吗
  • vue-cli 使用 报错
  • 适用于分析原因的工具有哪些
  • javascript教程chm
  • javascript学习指南
  • Python出现keyerror
  • js验证码代码怎么写
  • 国家税务网站官网
  • 税务上门核查要看什么
  • 济南车辆购置税完税证明电子版
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设