Home > php教程 > php手册 > 分享PHP unpack函数解压缩位字符串实现技巧

分享PHP unpack函数解压缩位字符串实现技巧

WBOY
Release: 2016-06-13 11:10:47
Original
1204 people have browsed it

我们曾经向朋友们介绍过

PHP unpack函数定义

解压缩位字符串资料。

语法:

string pack(string format, mixed [args]...);

返回值:

数组

PHP unpack函数种类:

资料处理

PHP unpack函数内容说明

本函数用来将位的字符串的资料解压缩。本函数和 Perl 的同名函数功能用法完全相同。参数 format 为压缩的格式。

PHP unpack函数例子 1

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><span> ?php  </span></span></span></li>
<li>
<span>$</span><span class="attribute">data</span><span> = </span><span class="attribute-value">"PHP"</span><span>;  </span>
</li>
<li class="alt"><span>print_r(unpack("C*",$data));  </span></li>
<li>
<span class="tag">?></span><span> </span>
</li>
</ol>
Copy after login

输出:

  1. Array  
  2. (  
  3. [1] => 80  
  4. [2] => 72  
  5. [3] => 80  


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template