Documentation ¶
Overview ¶
PHP built-in function library with Go language
Index ¶
- Constants
- func Abs(number float64) float64
- func Acos(x complex128) complex128
- func Acosh(x complex128) complex128
- func Addcslashes(s string, c byte) string
- func Addslashes(str string) string
- func Array(v ...interface{}) []interface{}
- func ArrayChunk(s []interface{}, size int) [][]interface{}
- func ArrayColumn(arrayMap map[string]map[string]interface{}, columnKey string) (r []interface{})
- func ArrayCombine(s1, s2 []interface{}) map[interface{}]interface{}
- func ArrayCountValues(s []interface{}) map[interface{}]uint
- func ArrayFill(startIndex int, num uint, value interface{}) map[int]interface{}
- func ArrayFillKeys(keys []interface{}, value interface{}) map[interface{}]interface{}
- func ArrayFlip(arrayMap map[interface{}]interface{}) map[interface{}]interface{}
- func ArrayIntersect(nums1, nums2 []int) []int
- func ArrayKeyExists(key interface{}, m map[interface{}]interface{}) bool
- func ArrayKeys(elements map[interface{}]interface{}) []interface{}
- func ArrayMerge(ss ...[]interface{}) []interface{}
- func ArrayPad(s []interface{}, size int, val interface{}) []interface{}
- func ArrayPop(s *[]interface{}) interface{}
- func ArrayPush(s *[]interface{}, elements ...interface{}) int
- func ArrayRand(elements []interface{}) []interface{}
- func ArrayReverse(s []interface{}) []interface{}
- func ArrayShift(s *[]interface{}) interface{}
- func ArraySlice(s []interface{}, offset, length uint) []interface{}
- func ArrayUnshift(s *[]interface{}, elements ...interface{}) int
- func ArrayValues(elements map[interface{}]interface{}) []interface{}
- func Asin(x complex128) complex128
- func Asinh(x complex128) complex128
- func Atan(x complex128) complex128
- func Atan2(y, x float64) float64
- func Atanh(x complex128) complex128
- func Base64Decode(s string) (string, error)
- func Base64Encode(s string) string
- func BaseConvert(num string, frombase, tobase int) (string, error)
- func Basename(path string) string
- func Bin2hex(str string) (string, error)
- func Bindec(str string) (string, error)
- func Boolval(val interface{}) bool
- func Ceil(x float64) float64
- func Chdir(dir string) error
- func Checkdate(month, day, year uint) bool
- func Chgrp(name string, uid, gid int) error
- func Chmod(filename string, mode os.FileMode) bool
- func Chown(filename string, uid, gid int) bool
- func Chr(ascii int) string
- func ChunkSplit(str string, chunkLen int, end string) string
- func Closedir(fd int) (err error)
- func Copy(source, dest string) (bool, error)
- func Cos(x float64) float64
- func Cosh(x float64) float64
- func Count(v []interface{}) int
- func Crc32(str string) uint32
- func Date(format string, timestamp int64) string
- func DateAdd(t time.Time, years int, months int, days int) time.Time
- func Decbin(x int64) string
- func Dechex(x int64) string
- func Decoct(x int64) string
- func Delete(filename string) error
- func Die(status int)
- func Dirname(dirPth string) ([]os.FileInfo, error)
- func DiskFreeSpace(directory string) (uint64, error)
- func DiskTotalSpace(directory string) (uint64, error)
- func Echo(args ...interface{})
- func Empty(v interface{}) bool
- func Exec(command string, output *[]string, returnVar *int) string
- func Exit(status int)
- func Exp(x float64) float64
- func Explode(delimiter, str string) []string
- func Expm1(x float64) float64
- func Fclose(handle *os.File) error
- func Fgetcsv(handle *os.File, length int, delimiter rune) ([][]string, error)
- func FileExists(filename string) bool
- func FileGetContents(filename string) (string, error)
- func FilePutContents(filename string, data string, mode os.FileMode) error
- func FileSize(filename string) (int64, error)
- func Filemtime(filename string) (int64, error)
- func Floor(x float64) float64
- func GetHtmlTranslationTable() map[string]string
- func Getcwd() (string, error)
- func Getenv(varname string) string
- func Gethostbyaddr(ipAddress string) (string, error)
- func Gethostbyname(hostname string) (string, error)
- func Gethostbynamel(hostname string) ([]string, error)
- func Gethostname() (string, error)
- func Gettype(v interface{}) string
- func Glob(pattern string) (matches []string, err error)
- func HTMLEntityDecode(str string) string
- func HTTPBuildQuery(queryData url.Values) string
- func Hex2bin(data string) (string, error)
- func Hexdec(str string) (int64, error)
- func Htmlentities(str string) string
- func Htmlspecialchars(s string) string
- func HtmlspecialcharsDecode(s string) string
- func IP2long(ipAddress string) uint32
- func Implode(glue string, pieces []string) string
- func InArray(needle interface{}, haystack interface{}) bool
- func Intval(str string) (int, error)
- func IsBool(v interface{}) bool
- func IsDir(filename string) (bool, error)
- func IsFile(filename string) bool
- func IsFinite(f float64, sign int) bool
- func IsInfinite(f float64, sign int) bool
- func IsNan(f float64) bool
- func IsNumeric(x interface{}) (result bool)
- func IsReadable(filename string) bool
- func IsWritable(name string) bool
- func IsWriteable(filename string) bool
- func JSONDecode(data []byte, val interface{}) error
- func JSONEncode(val interface{}) ([]byte, error)
- func Join(a []string, sep string) string
- func JsonDecode(data []byte, v interface{}) error
- func JsonEncode(v interface{}) ([]byte, error)
- func Lcfirst(str string) string
- func Levenshtein(str1, str2 string, costIns, costRep, costDel int) int
- func Log(x float64) float64
- func Log10(x float64) float64
- func Log1p(x float64) float64
- func Long2ip(properAddress uint32) string
- func Ltrim(str string, characterMask ...string) string
- func Max(nums ...float64) float64
- func MbStrlen(s string) int
- func MbSubstr(s string, start int, length ...int) string
- func Md5(s string) string
- func Md5File(path string) (string, error)
- func MemoryGetUsage(realUsage bool) uint64
- func Min(nums ...float64) float64
- func Mkdir(filename string, mode os.FileMode) error
- func MkdirAll(filename string, mode os.FileMode) error
- func Nl2br(str string, isXhtml bool) string
- func NumberFormat(number float64, decimals uint, decPoint, thousandsSep string) string
- func Octdec(str string) (int64, error)
- func Ord(char string) int
- func Pack(order binary.ByteOrder, data interface{}) (string, error)
- func ParseStr(encodedString string, result map[string]interface{}) error
- func ParseURL(str string, component int) (map[string]string, error)
- func ParseUrl(rawurl string) (*url.URL, error)
- func Passthru(command string, returnVar *int)
- func Pathinfo(path string, options int) map[string]string
- func Pi() float64
- func Pow(x, y float64) float64
- func Print(v interface{})
- func PrintR(v interface{})
- func Putenv(setting string) error
- func Quotemeta(str string) string
- func Rand(min, max int) int
- func Rawurldecode(s string) (string, error)
- func Rawurlencode(s string) string
- func Realpath(path string) (string, error)
- func Rename(oldpath, newpath string) error
- func Rmdir(path string) error
- func Round(x float64) float64
- func Rtrim(str string, characterMask ...string) string
- func Scandir(dirname string) ([]os.FileInfo, error)
- func Sha1(s string) string
- func Sha1File(path string) (string, error)
- func SimilarText(first, second string, percent *float64) int
- func Sin(x float64) float64
- func Sinh(x float64) float64
- func Sleep(s int64)
- func Soundex(str string) string
- func Sqrt(x float64) float64
- func Stat(name string) (os.FileInfo, error)
- func StrPad(s string, length int, args ...string) string
- func StrRepeat(s string, count int) string
- func StrReplace(search, replace, subject string, count int) string
- func StrShuffle(str string) string
- func StrWordCount(str string) []string
- func StripTags(s string) string
- func Stripos(haystack, needle string, offset int) int
- func Stripslashes(str string) string
- func Strlen(s string) int
- func Strpos(haystack, needle string, offset int) int
- func Strrchr(s, substr string) string
- func Strrev(str string) string
- func Strripos(haystack, needle string, offset int) int
- func Strrpos(haystack, needle string, offset int) int
- func Strstr(haystack string, needle string) string
- func Strtolower(str string) string
- func Strtotime(format, strtime string) (int64, error)
- func Strtoupper(str string) string
- func Strtr(haystack string, params ...interface{}) string
- func Strval(val interface{}) string
- func Substr(str string, start uint, length int) string
- func SubstrCount(s, substr string) int
- func SysGetTempDir() string
- func System(command string, returnVar *int) string
- func Tan(x float64) float64
- func Tanh(x float64) float64
- func Ternary(condition bool, trueVal, falseVal interface{}) interface{}
- func Time() int64
- func Touch(filename string) (bool, error)
- func Trim(str string, characterMask ...string) string
- func URLDecode(str string) (string, error)
- func URLEncode(str string) string
- func Ucfirst(str string) string
- func Ucwords(str string) string
- func Umask(mask int) int
- func Uniqid(prefix string) string
- func Unlink(name string) error
- func Unpack(order binary.ByteOrder, data string) (interface{}, error)
- func Urldecode(s string) (string, error)
- func Urlencode(s string) string
- func Usleep(ms int64)
- func VersionCompare(version1, version2, operator string) bool
- func Wordwrap(str string, width uint, br string, cut bool) string
- func ZipOpen(filename string) (*zip.ReadCloser, error)
- type ArrayMap
Constants ¶
const ( CaseLOWER = iota CaseUPPER )
Constants for ArrayChangeKeyCase
const ( StrPadRight = "STR_PAD_RIGHT" StrPadLeft = "STR_PAD_LEFT" )
Constants for StrPad
Variables ¶
This section is empty.
Functions ¶
func Addcslashes ¶
Addcslashes - Quote string with slashes in a C style
func ArrayChunk ¶
func ArrayChunk(s []interface{}, size int) [][]interface{}
ArrayChunk array_chunk()
func ArrayColumn ¶
ArrayColumn array_column() ArrayColumn — Return the values from a single column in the input array
func ArrayCombine ¶
func ArrayCombine(s1, s2 []interface{}) map[interface{}]interface{}
ArrayCombine array_combine()
func ArrayCountValues ¶
func ArrayCountValues(s []interface{}) map[interface{}]uint
ArrayCountValues — Counts all the values of an array
func ArrayFillKeys ¶
func ArrayFillKeys(keys []interface{}, value interface{}) map[interface{}]interface{}
ArrayFillKeys - Fill an array with values, specifying keys
func ArrayFlip ¶
func ArrayFlip(arrayMap map[interface{}]interface{}) map[interface{}]interface{}
ArrayFlip - Exchanges all keys with their associated values in an array
func ArrayIntersect ¶
ArrayIntersect — Computes the intersection of arrays
func ArrayKeyExists ¶
func ArrayKeyExists(key interface{}, m map[interface{}]interface{}) bool
ArrayKeyExists array_key_exists()
func ArrayKeys ¶
func ArrayKeys(elements map[interface{}]interface{}) []interface{}
ArrayKeys array_keys()
func ArrayPad ¶
func ArrayPad(s []interface{}, size int, val interface{}) []interface{}
ArrayPad array_pad()
func ArrayPop ¶
func ArrayPop(s *[]interface{}) interface{}
ArrayPop array_pop() Pop the element off the end of slice
func ArrayPush ¶
func ArrayPush(s *[]interface{}, elements ...interface{}) int
ArrayPush - Push one or more elements onto the end of array
func ArrayShift ¶
func ArrayShift(s *[]interface{}) interface{}
ArrayShift array_shift() Shift an element off the beginning of slice
func ArraySlice ¶
func ArraySlice(s []interface{}, offset, length uint) []interface{}
ArraySlice array_slice()
func ArrayUnshift ¶
func ArrayUnshift(s *[]interface{}, elements ...interface{}) int
ArrayUnshift array_unshift() Prepend one or more elements to the beginning of a slice
func ArrayValues ¶
func ArrayValues(elements map[interface{}]interface{}) []interface{}
ArrayValues array_values()
func Base64Decode ¶
Base64Decode - Decodes data encoded with MIME base64
func BaseConvert ¶
BaseConvert - Convert a number between arbitrary bases
func ChunkSplit ¶
ChunkSplit - Split a string into smaller chunks
func Count ¶
func Count(v []interface{}) int
Count - Count all elements in an array, or something in an object
func DateAdd ¶
DateAdd - Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object
func DiskFreeSpace ¶
DiskFreeSpace disk_free_space()
func DiskTotalSpace ¶
DiskTotalSpace disk_total_space()
func Expm1 ¶
Expm1 - Returns exp(number) - 1 computed in a way that is accurate even when the value of number is close to zero
func FileGetContents ¶
FileGetContents file_get_contents()
func FilePutContents ¶
FilePutContents file_put_contents()
func GetHtmlTranslationTable ¶
GetHtmlTranslationTable - Returns the translation table used by htmlspecialchars() and htmlentities()
func Gethostbyaddr ¶
Gethostbyaddr gethostbyaddr() Get the Internet host name corresponding to a given IP address
func Gethostbyname ¶
Gethostbyname gethostbyname() Get the IPv4 address corresponding to a given Internet host name
func Gethostbynamel ¶
Gethostbynamel gethostbynamel() Get a list of IPv4 addresses corresponding to a given Internet host name
func HTMLEntityDecode ¶
HTMLEntityDecode html_entity_decode()
func HTTPBuildQuery ¶
HTTPBuildQuery http_build_query()
func Htmlspecialchars ¶
Htmlspecialchars - Convert special characters to HTML entities
func HtmlspecialcharsDecode ¶
HtmlspecialcharsDecode - Convert special HTML entities back to characters
func InArray ¶
func InArray(needle interface{}, haystack interface{}) bool
InArray in_array() haystack supported types: slice, array or map
func IsInfinite ¶
IsInfinite - Finds whether a value is infinite
func IsNumeric ¶
func IsNumeric(x interface{}) (result bool)
IsNumeric - Finds whether a variable is a number or a numeric string
func IsWritable ¶
IsWritable - Tells whether the filename is writable
func JsonDecode ¶
JsonDecode - Decodes a JSON string
func JsonEncode ¶
JsonEncode - Returns the JSON representation of a value
func Levenshtein ¶
Levenshtein levenshtein() costIns: Defines the cost of insertion. costRep: Defines the cost of replacement. costDel: Defines the cost of deletion.
func Log1p ¶
Log1p - Returns log(1 + number) computed in a way that is accurate even when the value of number is close to zero
func MemoryGetUsage ¶
MemoryGetUsage memory_get_usage() return in bytes
func NumberFormat ¶
NumberFormat number_format() decimals: Sets the number of decimal points. decPoint: Sets the separator for the decimal point. thousandsSep: Sets the thousands separator.
func ParseURL ¶
ParseURL parse_url() Parse a URL and return its components -1: all; 1: scheme; 2: host; 4: port; 8: user; 16: pass; 32: path; 64: query; 128: fragment
func Pathinfo ¶
Pathinfo pathinfo() -1: all; 1: dirname; 2: basename; 4: extension; 8: filename Usage: Pathinfo("/home/go/path/src/php2go/php2go.go", 1|2|4|8)
func PrintR ¶
func PrintR(v interface{})
PrintR - Prints human-readable information about a variable
func Rawurldecode ¶
Rawurldecode - Decodes URL-encoded string
func Rawurlencode ¶
Rawurlencode - URL-encode according to RFC 3986
func SimilarText ¶
SimilarText similar_text()
func StrReplace ¶
StrReplace str_replace()
func Strtotime ¶
Strtotime strtotime() Strtotime("02/01/2006 15:04:05", "02/01/2016 15:04:05") == 1451747045 Strtotime("3 04 PM", "8 41 PM") == -62167144740
func Strtr ¶
Strtr strtr()
If the parameter length is 1, type is: map[string]string Strtr("baab", map[string]string{"ab": "01"}) will return "ba01" If the parameter length is 2, type is: string, string Strtr("baab", "ab", "01") will return "1001", a => 0; b => 1.
func SubstrCount ¶
SubstrCount - Count the number of substring occurrences
func SysGetTempDir ¶
func SysGetTempDir() string
SysGetTempDir - Returns directory path used for temporary files
func System ¶
System system() returnVar, 0: succ; 1: fail Returns the last line of the command output on success, and "" on failure.
func Ternary ¶
func Ternary(condition bool, trueVal, falseVal interface{}) interface{}
Ternary Ternary expression max := Ternary(a > b, a, b).(int)
func VersionCompare ¶
VersionCompare version_compare() The possible operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne respectively. special version strings these are handled in the following order, (any string not found) < dev < alpha = a < beta = b < RC = rc < # < pl = p Usage: VersionCompare("1.2.3-alpha", "1.2.3RC7", '>=') VersionCompare("1.2.3-beta", "1.2.3pl", 'lt') VersionCompare("1.1_dev", "1.2any", 'eq')
Types ¶
Source Files ¶
- addcslashes.go
- addslashes.go
- array.go
- array_change_key_case.go
- array_chunk.go
- array_column.go
- array_count_values.go
- array_fill.go
- array_fill_keys.go
- array_flip.go
- array_intersect.go
- array_keys.go
- array_merge.go
- array_push.go
- array_reverse.go
- base64.go
- basename.go
- checkdate.go
- chunk_split.go
- date.go
- date_add.go
- directory.go
- doc.go
- echo.go
- exec.go
- exit.go
- file_get_contents.go
- file_put_contents.go
- filesystem.go
- helpers.go
- helpers_unix.go
- is_file.go
- is_numeric.go
- json.go
- math.go
- md5.go
- number_format.go
- print.go
- print_r.go
- scandir.go
- sha1.go
- sleep.go
- strings.go
- sys_get_temp_dir.go
- time.go
- url.go
- variable.go