久久调教,免费看黄色影片,www五月,国产精品免费一区二区区,亚洲欧美日韩综合一区,亚洲欧美日韩精品在线,2021免费日韩视频网

龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開(kāi)發(fā),龍巖分銷(xiāo)系統(tǒng)

php數(shù)組與字符串轉(zhuǎn)換

2015.09.10 | 986閱讀 | 0條評(píng)論 | php

1、將字符串轉(zhuǎn)換成數(shù)組的幾個(gè)函數(shù): (1)explode(separate,string) 示例:$str = "Hello world It's a beautiful day"; explode(" ",$str);//以空格為分界點(diǎn) 返回:array([0]=>"Hello",[1]=>"world",[2]=>"It's",[3]=>"a",[4]=>"beautiful",[5]=>"day") (2)str_split(string,length) //length指每個(gè)數(shù)組元素的長(zhǎng)度,默認(rèn)情況下為1 示例:$str = "hello"; $a=str_split($str,3); $b=str_split($str); 返回:a([0]=>"hel",[1]=>"lo")??? b([0]=>"h",[1]=>"e",[2]=>"l",[3]=>"l",[4]=>"o") (3)unserialize(string) 反序列化,將已序列化的字符串返回到原數(shù)組形式。 2、將數(shù)組轉(zhuǎn)換成字符串的幾個(gè)函數(shù): (1)implode(separate,array)? //explode的反向操作,separate默認(rèn)為空字符 示例:$array = ('hello','world','!'); implode(" ",$array); 返回:"hello world !" (2)serialize(array) 序列化,將數(shù)組按照固定格式轉(zhuǎn)換成字符串;

贊 (

發(fā)表評(píng)論