Home >Backend Development >Golang >Summary of Golang's implementation of common PHP functions
The following column will introduce you to Golang’s implementation of PHP common functions from the golang tutorial column. I hope it will be helpful to friends in need!
# go-to-php(https://github.com/Echo-Mr-Pengw/go-to-php)
Use Golang to encapsulate commonly used functions in PHP. In order to distinguish functions in PHP and Go, the functions encapsulated by go-to-php are all preceded by a capital P
. Except for Pallord
functions. Click github
for the code address to install
1. String related packages
go get -u github. com/Echo-Mr-Pengw/go-to-php/str
2. Array related packagesunder development
…….
String related functions
go-to-php package function | Corresponding PHP function |
---|---|
Pimplode(glue string , pieces interface{}) string |
implode |
Pjoin(glue string , pieces interface{}) string |
alias of implode, same as Pimplode |
Pexplode(delimiter , str string , limit int) []string |
explode |
Pstrlen(str string) int |
strlen |
Pmb_strlen(str string) int |
mb_strlen |
str string) string
| lcfirst|
str string) string
| ucfirst|
str string) string
| strtoupper |
str string) string
| strtolower|
str string) string
| ucword|
, character_mask string) string trim |
|
, character_mask string) string ltrim |
|
, character_mask string) string rtrim |
|
, character_mask string) string alias of rtrim, the same as Prtrim |
|
string) string md5 |
|
string) string sha1 |
##Pord( |
ord |
Pallord( |
Convert all Character, upgraded version of ord |
Pchr( |
chr |
Pecho ( |
echo |
Pvar_dump( |
var_dump |
##Pprint( | a
print
|
Pstr_repeat( | input
int) string str_repeat
|
|
The above is the detailed content of Summary of Golang's implementation of common PHP functions. For more information, please follow other related articles on the PHP Chinese website!