本文由golang教程欄目給大家介紹關(guān)于Golang怎么實(shí)現(xiàn)PHP常用函數(shù),希望對(duì)需要的朋友有所幫助!
go-to-php
用Golang封裝PHP常用的函數(shù),為了區(qū)分PHP與Go中的函數(shù),go-to-php封裝的函數(shù),都是在對(duì)應(yīng)的PHP函數(shù)的前面加上大寫的P
。Pallord
函數(shù)除外。相關(guān)代碼點(diǎn)擊github(https://github.com/Echo-Mr-Pengw/go-to-php)
安裝
-
字符串相關(guān)包
go get -u github.com/Echo-Mr-Pengw/go-to-php/str
-
數(shù)組相關(guān)包
開(kāi)發(fā)中
…….
字符串相關(guān)函數(shù)
go-to-php封裝函數(shù) | 對(duì)應(yīng)的PHP函數(shù) |
---|---|
Pimplode(glue string , pieces interface{}) string |
implode |
Pjoin(glue string , pieces interface{}) string |
implode的別名,同Pimplode |
Pexplode(delimiter , str string , limit int) []string |
explode |
Pstrlen(str string) int |
strlen |
Pmb_strlen(str string) int |
mb_strlen |
Plcfirst(str string) string |
lcfirst |
Pucfirst(str string) string |
ucfirst |
Pstrtoupper(str string) string |
strtoupper |
Pstrtolower(str string) string |
strtolower |
Pucword(str string) string |
ucword |
Ptrim(str , character_mask string) string |
trim |
Pltrim(str , character_mask string) string |
ltrim |
Prtrim(str , character_mask string) string |
rtrim |
Pchop(str , character_mask string) string |
rtrim的別名,同Prtrim |
Pmd5(str string) string |
md5 |
Psha1(str string) string |
sha1 |
Pord(str string) int |
ord |
Pallord(str string) interface{} |
轉(zhuǎn)化全部字符,ord的升級(jí)版 |
Pchr(ascii int32) string |
chr |
Pecho(a ... interface{}) |
echo |
Pvar_dump(a ... interface{}) |
var_dump |
Pprint(a interface{}) |
|
Pstr_repeat(input string , multiplier int) string |
str_repeat |