php

package
v0.0.0-...-0666a57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

PHP built-in function library with Go language

Index

Constants

View Source
const (
	CaseLOWER = iota
	CaseUPPER
)

Constants for ArrayChangeKeyCase

View Source
const (
	StrPadRight = "STR_PAD_RIGHT"
	StrPadLeft  = "STR_PAD_LEFT"
)

Constants for StrPad

Variables

This section is empty.

Functions

func Abs

func Abs(x float64) float64

Abs - Absolute xue

func Acos

func Acos(x complex128) complex128

Acos - Arc cosine

func Acosh

func Acosh(x complex128) complex128

Acosh - Inverse hyperbolic cosine

func Addcslashes

func Addcslashes(s string, c byte) string

Addcslashes - Quote string with slashes in a C style

func Addslashes

func Addslashes(s string) string

Addslashes - Quote string with slashes

func Array

func Array(v ...interface{}) []interface{}

Array - Create an array

func ArrayColumn

func ArrayColumn(arrayMap map[string]map[string]interface{}, columnKey string) (r []interface{})

ArrayColumn — Return the values from a single column in the input array

func ArrayCountValues

func ArrayCountValues(s []interface{}) map[interface{}]uint

ArrayCountValues — Counts all the values of an array

func ArrayFill

func ArrayFill(startIndex uint, num uint, value interface{}) map[uint]interface{}

ArrayFill - Fill an array with values

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

func ArrayIntersect(nums1, nums2 []int) []int

ArrayIntersect — Computes the intersection of arrays

func ArrayKeys

func ArrayKeys(data map[string]interface{}) []string

ArrayKeys - get keys of map data as a Array in php,the keys you want always is string or number here,let it be string

func ArrayMerge

func ArrayMerge(arr ...[]interface{}) []interface{}

ArrayMerge — Merge one or more arrays

func ArrayPush

func ArrayPush(s *[]string, args ...string)

ArrayPush - Push one or more elements onto the end of array

func ArrayReverse

func ArrayReverse(s []interface{}) []interface{}

ArrayReverse - Return an array with elements in reverse order

func Asin

func Asin(x complex128) complex128

Asin - Arc sine

func Asinh

func Asinh(x complex128) complex128

Asinh - Inverse hyperbolic sine

func Atan

func Atan(x complex128) complex128

Atan - Arc tangent

func Atan2

func Atan2(y, x float64) float64

Atan2 - Arc tangent of two variables

func Atanh

func Atanh(x complex128) complex128

Atanh - Inverse hyperbolic tangent

func Base64Decode

func Base64Decode(s string) (string, error)

Base64Decode - Decodes data encoded with MIME base64

func Base64Encode

func Base64Encode(s string) string

Base64Encode - Encodes data with MIME base64

func BaseConvert

func BaseConvert(num string, frombase, tobase int) (string, error)

BaseConvert - Convert a number between arbitrary bases

func Basename

func Basename(path string) string

Basename - Returns trailing name component of path

func Bin2hex

func Bin2hex(b string) string

Bin2hex - Convert binary data into hexadecimal representation

func Bindec

func Bindec(b string) int64

Bindec - Binary to decimal

func Boolval

func Boolval(val interface{}) bool

Boolval - Get the boolean value of a variable

func Ceil

func Ceil(x float64) float64

Ceil - Round fractions up

func Chdir

func Chdir(dir string) error

Chdir - Change directory

func Checkdate

func Checkdate(month, day, year uint) bool

Checkdate - Validate a Gregorian date

func Chgrp

func Chgrp(name string, uid, gid int) error

Chgrp - Changes file group

func Chmod

func Chmod(name string, mode os.FileMode) error

Chmod - Changes file mode

func Chown

func Chown(name string, uid int, gid int) error

Chown - Chown changes the numeric uid and gid of the named file.

func Chr

func Chr(ascii int) string

Chr - Return a specific character

func ChunkSplit

func ChunkSplit(str string, chunkLen int, end string) string

ChunkSplit - Split a string into smaller chunks

func Copy

func Copy(dstName string, srcName string) (written int64, err error)

Copy - Copies file

func Cos

func Cos(x float64) float64

Cos - Cosine

func Cosh

func Cosh(x float64) float64

Cosh - Hyperbolic cosine

func Count

func Count(v []interface{}) int

Count - Count all elements in an array, or something in an object

func Date

func Date(format string, ts ...time.Time) string

Date - Format a local time/date

func DateAdd

func DateAdd(t time.Time, years int, months int, days int) time.Time

DateAdd - Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object

func Decbin

func Decbin(x int64) string

Decbin - Decimal to binary

func Dechex

func Dechex(x int64) string

Dechex - Decimal to hexadecimal

func Decoct

func Decoct(x int64) string

Decoct - Decimal to octal

func Delete

func Delete(name string) error

Delete - Deletes a file

func Die

func Die(code int)

Die — Equivalent to exit

func Dirname

func Dirname(dirPth string) ([]os.FileInfo, error)

Dirname - Returns a parent directory's path

func Echo

func Echo(args ...interface{})

Echo - Output one or more strings

func Empty

func Empty(v interface{}) bool

Empty - Determine whether a variable is empty

func Exec

func Exec(s string)

Exec - Execute an external program

func Exit

func Exit(code int)

Exit — Output a message and terminate the current script

func Exp

func Exp(x float64) float64

Exp - Calculates the exponent of e

func Explode

func Explode(s, sep string) []string

Explode - Split a string by string

func Expm1

func Expm1(x float64) float64

Expm1 - Returns exp(number) - 1 computed in a way that is accurate even when the value of number is close to zero

func Fclose

func Fclose(file *os.File) error

Fclose - Closes an open file pointer

func FileExists

func FileExists(path string) bool

FileExists - Checks whether a file or directory exists

func FileGetContents

func FileGetContents(filename string) ([]byte, error)

FileGetContents - Reads entire file into a string

func FilePutContents

func FilePutContents(filename string, data []byte) error

FilePutContents - Write data to a file

func Filemtime

func Filemtime(file string) time.Time

Filemtime - Gets file modification time

func Floor

func Floor(x float64) float64

Floor - Round fractions down

func GetHtmlTranslationTable

func GetHtmlTranslationTable() map[string]string

GetHtmlTranslationTable - Returns the translation table used by htmlspecialchars() and htmlentities()

func Getcwd

func Getcwd() (dir string)

Getcwd - Get current directory

func Gettype

func Gettype(v interface{}) string

Gettype - Get the type of a variable

func Glob

func Glob(pattern string) (matches []string, err error)

Glob - Find pathnames matching a pattern

func Hex2bin

func Hex2bin(x string) string

Hex2bin - Decodes a hexadecimally encoded binary string

func Htmlspecialchars

func Htmlspecialchars(s string) string

Htmlspecialchars - Convert special characters to HTML entities

func HtmlspecialcharsDecode

func HtmlspecialcharsDecode(s string) string

HtmlspecialcharsDecode - Convert special HTML entities back to characters

func Implode

func Implode(a []string, sep string) string

Implode - Join array elements with a string

func Intval

func Intval(str string) (int, error)

Intval - Get the integer value of a variable

func IsBool

func IsBool(v interface{}) bool

IsBool - Finds out whether a variable is a boolean

func IsDir

func IsDir(name string) bool

IsDir - Tells whether the filename is a directory

func IsFile

func IsFile(name string) bool

IsFile Tells whether the filename is a regular file

func IsFinite

func IsFinite(f float64, sign int) bool

IsFinite - Finds whether a value is a legal finite number

func IsInfinite

func IsInfinite(f float64, sign int) bool

IsInfinite - Finds whether a value is infinite

func IsNan

func IsNan(f float64) bool

IsNan - Finds whether a value is not a number

func IsNumeric

func IsNumeric(x interface{}) (result bool)

IsNumeric - Finds whether a variable is a number or a numeric string

func IsReadable

func IsReadable(name string) bool

IsReadable - Tells whether a file exists and is readable

func IsWritable

func IsWritable(name string) bool

IsWritable - Tells whether the filename is writable

func IsWriteable

func IsWriteable(name string) bool

IsWriteable - Alias of IsWritable()

func Join

func Join(a []string, sep string) string

Join - Alias of implode()

func JsonDecode

func JsonDecode(data []byte, v interface{}) error

JsonDecode - Decodes a JSON string

func JsonEncode

func JsonEncode(v interface{}) ([]byte, error)

JsonEncode - Returns the JSON representation of a value

func Log

func Log(x float64) float64

Log - Natural logarithm

func Log10

func Log10(x float64) float64

Log10 - Base-10 logarithm

func Log1p

func Log1p(x float64) float64

Log1p - Returns log(1 + number) computed in a way that is accurate even when the value of number is close to zero

func Ltrim

func Ltrim(s, cutset string) string

Ltrim - Strip whitespace (or other characters) from the beginning of a string

func Max

func Max(x, y float64) float64

Max - Find highest value

func MbStrlen

func MbStrlen(s string) int

MbStrlen - Get string length

func MbSubstr

func MbSubstr(s string, start int, length ...int) string

MbSubstr - Get part of string

func Md5

func Md5(s string) string

Md5 - Calculate the md5 hash of a string

func Md5File

func Md5File(filename string) string

Md5File - Calculates the md5 hash of a given file

func Min

func Min(x, y float64) float64

Min - Find lowest value

func Mkdir

func Mkdir(name string, mode os.FileMode) error

Mkdir - Makes directory

func Nl2br

func Nl2br(s string) string

Nl2br - Inserts HTML line breaks before all newlines in a string

func NumberFormat

func NumberFormat(number float64, decimals uint, decPoint, thousandsSep string) string

NumberFormat — Format a number with grouped thousands

func Ord

func Ord(s byte) byte

Ord - Return ASCII value of character

func ParseStr

func ParseStr(query string) (url.Values, error)

ParseStr - Parses the string into variables

func ParseUrl

func ParseUrl(rawurl string) (*url.URL, error)

ParseUrl - Parse a URL and return its components

func Pi

func Pi() float64

Pi - Get value of pi

func Pow

func Pow(x, y float64) float64

Pow - Exponential expression

func Print

func Print(v interface{})

Print - Output a string

func PrintR

func PrintR(v interface{})

PrintR - Prints human-readable information about a variable

func Rand

func Rand(args ...int) int

Rand - Generate a random integer

func Rawurldecode

func Rawurldecode(s string) (string, error)

Rawurldecode - Decodes URL-encoded string

func Rawurlencode

func Rawurlencode(s string) string

Rawurlencode - URL-encode according to RFC 3986

func Realpath

func Realpath(path string) (string, error)

Realpath - Returns canonicalized absolute pathname

func Rename

func Rename(oldpath, newpath string) error

Rename - Renames a file or directory

func Rmdir

func Rmdir(path string) error

Rmdir — Removes directory

func Round

func Round(x float64) float64

Round - Rounds a float

func Rtrim

func Rtrim(s, cutset string) string

Rtrim - Strip whitespace (or other characters) from the end of a string

func Scandir

func Scandir(dirname string) ([]os.FileInfo, error)

scandir — List files and directories inside the specified path

func Sha1

func Sha1(s string) string

Sha1 - Calculate the sha1 hash of a string

func Sha1File

func Sha1File(filename string) string

Sha1File - Calculates the md5 hash of a given file

func Sin

func Sin(x float64) float64

Sin - Sine

func Sinh

func Sinh(x float64) float64

Sinh - Hyperbolic sine

func Sleep

func Sleep(s int64)

Sleep - Delay execution

func Sqrt

func Sqrt(x float64) float64

Sqrt - Square root

func Stat

func Stat(name string) (os.FileInfo, error)

Stat - Gives information about a file

func StrPad

func StrPad(s string, length int, args ...string) string

StrPad - Pad a string to a certain length with another string

func StrRepeat

func StrRepeat(s string, count int) string

StrRepeat - Repeat a string

func StrReplace

func StrReplace(s, old, new string, n int) string

StrReplace - Replace all occurrences of the search string with the replacement string

func StripTags

func StripTags(s string) string

StripTags - Strip HTML and PHP tags from a string

func Stripos

func Stripos(s, substr string) int

Stripos - Find the position of the first occurrence of a case-insensitive substring in a string

func Strlen

func Strlen(s string) int

Strlen - Get string length

func Strpos

func Strpos(s, substr string) int

Strpos - Find the position of the first occurrence of a substring in a string

func Strrchr

func Strrchr(s, substr string) string

Strrchr - Find the last occurrence of a character in a string

func Strrev

func Strrev(s string) string

Strrev - Reverse a string

func Strripos

func Strripos(s, substr string) int

Strripos - Find the position of the last occurrence of a case-insensitive substring in a string

func Strrpos

func Strrpos(s, substr string) int

Strrpos - Find the position of the last occurrence of a substring in a string

func Strstr

func Strstr(s, substr string) int

Strstr - Find the first occurrence of a string

func Strtolower

func Strtolower(s string) string

Strtolower - Make a string lowercase

func Strtoupper

func Strtoupper(s string) string

Strtoupper - Make a string uppercase

func Strval

func Strval(val interface{}) string

Strval - Get string value of a variable

func Substr

func Substr(s string, start int, length ...int) string

Substr - Return part of a string

func SubstrCount

func SubstrCount(s, substr string) int

SubstrCount - Count the number of substring occurrences

func SysGetTempDir

func SysGetTempDir() string

SysGetTempDir - Returns directory path used for temporary files

func Tan

func Tan(x float64) float64

Tan - Tangent

func Tanh

func Tanh(x float64) float64

Tanh - Hyperbolic tangent

func Time

func Time() int64

Time - Return current Unix timestamp

func Trim

func Trim(s, cutset string) string

Trim - Strip whitespace (or other characters) from the beginning and end of a string

func Ucfirst

func Ucfirst(s string) string

Ucfirst - Make a string's first character uppercase

func Ucwords

func Ucwords(s string) string

Ucwords — Uppercase the first character of each word in a string

func Unlink(name string) error

Unlink - Deletes a file

func Urldecode

func Urldecode(s string) (string, error)

Urldecode - Decodes URL-encoded string

func Urlencode

func Urlencode(s string) string

Urlencode - URL-encodes string

func Usleep

func Usleep(ms int64)

Usleep - Delay execution in microseconds

Types

type ArrayMap

type ArrayMap map[string]interface{}

ArrayMap is one of Array type

func ArrayChangeKeyCase

func ArrayChangeKeyCase(arr ArrayMap, Case int) ArrayMap

ArrayChangeKeyCase - Changes the case of all keys in an array

type ArraySlice

type ArraySlice []interface{}

ArraySlice type

func ArrayChunk

func ArrayChunk(input ArraySlice, size int) ArraySlice

ArrayChunk - Split an array into chunks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL