Categorygithub.com/cnjinhy/php-func-go
modulepackage
1.0.3
Repository: https://github.com/cnjinhy/php-func-go.git
Documentation: pkg.go.dev

# README

php-func-go

Description

Some PHP built-in functions implemented using Golang

使用golang实现的一些PHP函数,方便开发使用。

Note: Due to the language features of Golang and PHP, some functions are not 100% compatible. For example, the maps in Golang are unordered, and when using http_ build_query, the output order may be inconsistent. For example, arrays in Golang cannot be accessed outside the bounds, so there are restrictions on empty, and so on.

注意:由于GolangPHP的语言特性,有些函数并不是100%兼容,比如Golang中的map是无序的,当使用http_build_query的时候有可能输出顺序不一致,比如Golang中的数组不能越界访问,所以empty也有所限制,等等。

Demo

the README.md is generated using the php-func-go function by doc.go

README.md文件是通过doc.go生成的,doc.go使用了php-func-go的函数写的。

Unit Test

You can run go test in the dir tests

Function list

php functiongolang functioninput argvsreturn type
addslashesAddslashess stringstring
array_key_existsArrayKeyExistskey interface{}, array interface{}bool
base64_decodeBase64Decodeencoded stringstring
base64_encodeBase64Encodestr stringstring
basenameBasenamepath string, suffix ...stringstring
bin2hexBin2hexinput stringstring
checkdateCheckDatemonth, day, year intbool
chopChops string, charsToRemove ...stringstring
chrChrcodepoint intstring
copyCopysrc string, dest stringbool
crc32Crc32s stringuint32
dateDateformat string, timestamp ...interface{}string
dirnameDirnamepath string, levels ...intstring
echoEchoargs ...interface{}
emptyEmptyval interface{}bool
explodeExplodedelimiter string, str string[]string
file_existsFileExistsfilename stringbool
file_get_contentsFileGetContentsfilename stringstring
file_put_contentsFilePutContentsfilename string, data string, append ...intbool
filectimeFileCTimepath stringint64
filemtimeFileMTimepath stringint64
filesizeFilesizefilename stringint64
getrandmaxGetrandmaxint
gettypeGettypeany interface{}string
globGlobpattern string[]string
html_entity_decodeHtmlEntityDecodes stringstring
htmlentitiesHtmlEntitiess stringstring
htmlspecialcharsHtmlSpecialCharss stringstring
htmlspecialchars_decodeHtmlSpecialCharsDecodes stringstring
http_build_queryHttpBuildQuerydata interface{}string
implodeImplodeglue string, pieces []stringstring
in_arrayInArrayneedle interface{}, haystack interface{}, strict ...boolbool
is_dirIsDirpath stringbool
is_numericIsNumericvalue interface{}bool
is_readableIsReadablefilename stringbool
json_encodeJsonEncodevalue interface{}string
lcfirstLcfirststr stringstring
lcg_valueLcgValuefloat64
ltrimLtrims string, charsToRemove ...stringstring
mb_strlenMbStrlenstr stringint
mb_substrMbSubStrstr string, start int, length ...intstring
md5Md5args ...interface{}string
md5_fileMd5Filepath string, prevHash ...stringstring
microtimeMicrotimegetAsFloat ...boolinterface
mt_randMtRandmin int, max intint
nl2brNl2Brs string, useXHTML ...boolstring
ordOrds stringint
parse_urlParseUrlurlStr string*urlInfo
preg_replacePregReplacepattern string, replacement string, subject stringstring
preg_replace_callbackPregReplaceCallbackpattern string, subject string, callback funcstring
rawurldecodeRawUrlDecodestr string(string, error
rawurlencodeRawUrlEncodestr stringstring
rtrimRtrims string, charsToRemove ...stringstring
sha1Sha1s stringstring
sha1_fileSha1Filefilename string, binary ...boolstring
sleepSleepseconds int
str_containsStrContainshaystack string, needle stringbool
str_ends_withStrEndsWithhaystack string, needle stringbool
str_repeatStrRepeatinput string, time intstring
str_replaceStrReplacesearch interface{}, replace string, subject interface{}string
str_starts_withStrStartsWithhaystack string, needle stringbool
str_word_countStrWordCounts string, format ...intinterface
strip_tagsStripTagss stringstring
striposStriposhaystack string, needle stringinterface
strlenStrlenstr stringint
strposStrposhaystack string, needle stringinterface
strrevStrrevstr stringstring
strstrStrstrs, substr string, options ...boolstring
strtolowerStrToLowers stringstring
strtotimeStrToTimedateStr stringint64
strtoupperStrToUppers stringstring
strvalStrvalany interface{}string
substrSubStrstr string, start int, length ...int(substr string
substr_countSubstrCounts, sub string, args ...intint
substr_replaceSubstrReplacestr, replace string, start int, length ...intstring
timeTimeint64
time_sleep_untilTimeSleepUntiltimestamp int64
trimTrimstr string, charlist ...stringstring
ucfirstUcfirsts stringstring
ucwordsUcwordss stringstring
urldecodeUrlDecodestr stringstring
urlencodeUrlEncodestr stringstring
usleepUsleepmicroseconds int
var_dumpVarDumpv interface{}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author