Home  >  Article  >  Backend Development  >  Summary of Golang’s implementation of common PHP functions

Summary of Golang’s implementation of common PHP functions

藏色散人
藏色散人forward
2021-01-20 17:44:333742browse

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!

Summary of Golang’s implementation of common PHP functions

# 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 packages
under development
…….

String related functions

##Plcfirst(lcfirst Pucfirst(ucfirstPstrtoupper(strtoupper Pstrtolower(strtolowerPucword(ucword##Ptrim(strPltrim(strPrtrim(strPchop(strPmd5(strPsha1(str##Pord(str string) intPallord(str string) interface{}Pchr(ascii int32) stringPecho (a ...interface{})Pvar_dump(a ...interface{}) a interface{})input string , multiplierFor more golang related technical articles, please visit the go language
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
str string) string
str string) string
str string) string
str string) string
, character_mask string) string trim
, character_mask string) stringltrim
, character_mask string) stringrtrim
, character_mask string) stringalias of rtrim, the same as Prtrim
string) string md5
string) stringsha1
ord
Convert all Character, upgraded version of ord
chr
echo
var_dump ##Pprint(
print Pstr_repeat(
int) stringstr_repeat


column!

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!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete