Home  >  Article  >  Backend Development  >  Do you know how Golang encapsulates common PHP functions?

Do you know how Golang encapsulates common PHP functions?

藏色散人
藏色散人forward
2022-01-21 16:01:402938browse

This article is provided by the golang tutorial column to introduce to you how to implement common PHP functions in Golang. I hope it will be helpful to friends in need!

go-to-php

Use Golang to encapsulate common functions in PHP, in order to distinguish PHP from Go The functions in and the functions encapsulated by go-to-php are all preceded by an uppercase P in front of the corresponding PHP function. Except for Pallord functions. For related code, click github (https://github.com/Echo-Mr-Pengw/go-to-php)

Installation

  • String related packages

go get -u github.com/Echo-Mr-Pengw/go-to-php/str

  • array Related packages

under development

......

String related functions

##Pstrlen(strlenPmb_strlen(mb_strlenPlcfirst(lcfirstPucfirst(ucfirstPstrtoupper(strtoupperPstrtolower(strtolowerPucword(ucwordPtrim(trimPltrim(ltrimPrtrim(rtrimPchop(An alias for rtrim, the same as Prtrim Pmd5(md5Psha1(sha1Pord(ordPallord(Convert all characters, an upgraded version of ordPchr(chrPecho(echoPvar_dump(var_dumpPprint(printPstr_repeat(str_repeat
go-to-php encapsulation 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
str string) int
str string) int
str string) string
str string) string
str string) string
str string) string
str string) string
str , character_mask string) string
str , character_mask string) string
str , character_mask string) string
str , character_mask string) string
str string) string
str string) string
str string) int
str string) interface{}
ascii int32) string
a ...interface{})
a ...interface{})
a interface{})
input string , multiplier int) string

The above is the detailed content of Do you know how Golang encapsulates common PHP functions?. For more information, please follow other related articles on the PHP Chinese website!

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