


PHP is still relatively commonly used, so I studied PHP variable serialization and shared it with you here. I hope it will be useful to everyone. Serialization is probably about converting some variables into a byte stream of strings, which makes it easier to transmit and store. Of course, there is nothing to do with transmission and storage. The key is that it can be converted back into string form and the original data structure can be maintained.
PHP variable serialization
We give a simple example to illustrate PHP variable serialization and its storage format.
Integer type:
<ol class="dp-xml"> <li class="alt"><span><span>$</span><span class="attribute"><font color="#ff0000">var</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">23</font></span><span>; </span></span></li> <li class=""><span>echo serialize($var); </span></li> </ol>
Output: i:23;
Floating point type:
<ol class="dp-xml"> <li class="alt"><span><span>$</span><span class="attribute"><font color="#ff0000">var</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">1</font></span><span>.23; </span></span></li> <li class=""><span>echo serialize($var); </span></li> </ol>
Output: d:1.229999999999999982236431605997495353221893310546875; is a string";s: 8: "I am a variable";
Boolean:
<ol class="dp-xml"> <li class="alt"><span><span>$</span><span class="attribute"><font color="#ff0000">var</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">"This is a string"</font></span><span>; </span></span></li> <li class=""><span>echo serialize($var); </span></li> <li class="alt"> <span>$</span><span class="attribute"><font color="#ff0000">var</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">"我是变量"</font></span><span>; </span> </li> <li class=""><span>echo serialize($var); </span></li> </ol>
Output: b:1;b:0;
the above The situation after serialization of basic types is very clear. The storage format after serialization is: variable type: [variable length:] variable value; that is, the first character represents the variable type, the second: represents division, and the variable length is Optional, it is available in string types but not in other types. The last one is the variable value. Each serialized value ends with ";".
<ol class="dp-xml"> <li class="alt"><span><span>$</span><span class="attribute"><font color="#ff0000">var</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">true</font></span><span>; </span></span></li> <li class=""><span>echo serialize($var); </span></li> <li class="alt"> <span>$</span><span class="attribute"><font color="#ff0000">var</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">false</font></span><span>; </span> </li> <li class=""><span>echo serialize($var); </span></li> </ol>http://www.bkjia.com/PHPjc/446492.htmlwww.bkjia.com
true

Python函数介绍:exec函数的介绍及示例引言:在Python中,exec是一种内置函数,它用于执行存储在字符串或文件中的Python代码。exec函数提供了一种动态执行代码的方式,使得程序可以在运行时根据需要生成、修改和执行代码。本文将介绍exec函数的使用方法,并给出一些实际的代码示例。exec函数的使用方法:exec函数的基本语法如下所示:exec

i5是英特尔旗下的一系列处理器,拥有到现在11代i5的各种不同版本,每一代都有着不同性能。因此对于i5处理器是否能够安装win11,还需要看是第几代的处理器,下面就跟着小编一起来分别了解一下吧。i5处理器能装win11吗:答:i5处理器能装win11。一、第八代及之后的i51、第八代及后续的i5处理器是能够满足微软的最低配置需求的。2、因此我们只需要进入微软网站,下载一个“win11安装助手”3、下载完成后,运行该安装助手,根据提示进行操作就可以安装win11了。二、第八代之前的i51、第八代之

在如今快捷的生活,为了提高工作效率,快捷键是必不可少的工作需求。快捷键是指按键或按键组合,可提供另一种方式来执行通常使用鼠标执行的操作。那么edge快捷键有哪些呢?edge快捷键的功能又有哪些呢?下面小编整理了一份edge快捷键的介绍,感兴趣的朋友们快来看看吧!Ctrl+D:将当前页面添加到收藏夹或阅读列表Ctrl+E:在地址栏中执行搜索查询Ctrl+F:在页面上查找Ctrl+H:打开历史记录面板Ctrl+G:打开阅读列表面板Ctrl+I:打开收藏夹列表面板(测试好像不起作用)Ctrl+J:打开

近日,网络中有win10X系统的最新镜像下载流出,不同于常见的ISO,此次的镜像是.ffu格式,目前仅能用于SurfacePro7体验。虽然很多小伙伴不能体验,但是依旧可以看看测评的相关内容,过过瘾,那么一起来看看win10x系统最新评测吧!win10x系统最新评测 1、Win10X与Win10最大的不同首先就表现在开机后开始按钮等被放在了任务栏中央,除了固定的应用程序,任务栏还可以显示最近启动的应用程序,类似于Android和iOS手机。 2、另外一个就是,新系统的“开始”菜单不支持文

Python函数介绍:zip函数的介绍及示例Python是一种高级语言,它提供了许多有用的函数来帮助开发人员快速地编写程序。其中一个函数就是zip函数。Zip函数是Python中的内置函数之一,它可以接受一组可迭代对象(包括列表、元组、集合和字典等),并返回一个由这些可迭代对象中的元素按顺序成对组成的元组。Zip函数可以用于多种情况,例如:1.将两个列表的元

Java语言是一种高级编程语言,非常适合用于数学模型的构建和分析。数学模型是数学概念在现实世界中的应用,它们通常用于解决实际问题,例如预测未来趋势、优化生产和制造等。本文将介绍Java语言中常见的数学模型及其应用。线性规划线性规划是一种优化方法,在解决企业最优决策、资源配置以及生产计划等问题中广泛应用。在Java语言中,可以使用ApacheCommons

PHP函数介绍:strtr()函数在PHP编程中,strtr()函数是一个非常有用的字符串替换函数。它用于将字符串中的指定字符或字符串替换为其他字符或字符串。本文将介绍strtr()函数的用法,并给出一些具体的代码示例。strtr()函数的基本语法如下:strtr(string$str,array$replace)其中,$str是要进行替换操作的原始字

win7系统是微软经典的操作系统,其中win7旗舰版系统最为受欢迎,但是安装之后需要激活才能使用全部的功能。那么该如何激活win7系统呢?常见的方法就是win7激活工具或者密钥激活,下面小编就教下大家windows7旗舰版激活方法。我们以常用的win7激活工具,win7activation工具为例,具体的使用方法如下:1、首先在电脑上搜索并下载好win7activation工具软件包,解压后得到win7activation.exe的文件。鼠标右键点击exe文件,在弹出的菜单栏中点击以管理员身份运


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
