【转】http://www.syyong.com/Go/php2go-Use-Golang-to-implement-PHP-s-common-built-in-functions.html

使用Golang实现PHP常用内置函数,目前已经实现了130+函数。

下载&安装

https://github.com/syyongx/php2go

go get github.com/syyongx/php2go

PHP Functions

Date/Time Functions

time()
strtotime()
date()
sleep()
usleep()

String Functions

strpos()
stripos()
strrpos()
strripos()
str_replace()
ucfirst()
ucwords()
substr()
strrev()
number_format()
chunk_split()
str_word_count()
wordwrap()
strlen()
mb_strlen()
str_repeat()
strstr()
strtr()
str_shuffle()
trim()
ltrim()
rtrim()
explode()
strtoupper()
strtolower()
chr()
ord()
nl2br()
json_encode()
json_decode()
addslashes()
stripslashes()
quotemeta()
htmlentities()
html_entity_decode()
md5()
md5_file()
sha1()
sha1_file()
crc32()
levenshtein()
similar_text()
soundex()
parse_str()

URL Functions

parse_url()
urlencode()
urldecode()
build_http_query()
rawurlencode()
rawurldecode()
base64_encode()
base64_decode()

Array(Slice/Map) Functions

array_fill()
array_flip()
array_keys()
array_values()
array_merge()
array_chunk()
array_pad()
array_slice()
array_rand()
array_column()
array_pop()
array_shift()
array_unshift()
array_diff()
array_combine()
array_reverse()
implode()

Mathematical Functions

abs()
rand()
round()
floor()
ceil()
pi()
max()
min()
decbin()
bindec()
hex2bin()
bin2hex()
dechex()
hexdec()
decoct()
Octdec()
base_convert()
is_nan()

Directory/Filesystem Functions

stat()
file_exists()
is_file()
is_dir()
filesize()
file_put_contents()
file_get_contents()
unlink()
delete()
copy()
is_readable()
is_writeable()
rename()
touch()
mkdir()
getcwd()
realpath()
basename()
chmod()
chown()
fclose()
filemtime()
fgetcsv()
disk_free_space()
glob()

Variable handling Functions

empty()
is_numeric()

Program execution Functions

echo()
system()
passthru()

Other Functions

uniqid()
exec()
exit()
die()
getenv()
putenv()
memory_get_usage()
version_compare()
zip_open()
Ternary(condition bool, trueVal, falseVal interface{}) interface{}

LICENSE

php2go source code is licensed under the MIT Licence.

php2go - Go 实现 PHP 常用内置函数的更多相关文章

  1. MYSQL常用内置函数详解说明

    函数中可以将字段名当作变量来用,变量的值就是该列对应的所有值:在整理98在线字典数据时(http://zidian.98zw.com/),有这要一个需求,想从多音字duoyinzi字段值提取第一个拼音 ...

  2. Python常用模块中常用内置函数的具体介绍

    Python作为计算机语言中常用的语言,它具有十分强大的功能,但是你知道Python常用模块I的内置模块中常用内置函数都包括哪些具体的函数吗?以下的文章就是对Python常用模块I的内置模块的常用内置 ...

  3. MySQL学习笔记_7_MySQL常用内置函数

    MySQL常用内置函数 说明: 1)可以用在SELECT/UPDATE/DELETE中,及where,orderby,having中 2)在函数里将字段名作为参数,变量的值就是字段所对应的每一行的值. ...

  4. PYTHON语言之常用内置函数

    一 写在开头本文列举了一些常用的python内置函数.完整详细的python内置函数列表请参见python文档的Built-in Functions章节. 二 python常用内置函数请注意,有关内置 ...

  5. SqlServer常用内置函数

    --======================================= -- SQL常用内置函数 --======================================= --判 ...

  6. Python的常用内置函数介绍

    Python的常用内置函数介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.取绝对值(abs) #!/usr/bin/env python #_*_coding:utf-8_ ...

  7. python中的运算符及表达式及常用内置函数

    知识内容: 1.运算符与表达式 2.for\while初步了解 3.常用内置函数 一.运算符与表达式 python与其他语言一样支持大多数算数运算符.关系运算符.逻辑运算符以及位运算符,并且有和大多数 ...

  8. python第十八课——常用内置函数

    常用内置函数:round(): print(round(3.14),round(3.99)) print(round(3145.926,-2),round(413.575,2)) abs(): pri ...

  9. Python基础(二)——常用内置函数

    1. 常用内置函数 (1)isinstance(object, classinfo) 用于判断一个对象是否为某一类型. object  是实例对象 classinfo 是基本类型如 int, floa ...

随机推荐

  1. 清除远程桌面连接记录和SQLSERVER 连接记录的办法

    1.清除远程桌面连接记录: 清除远程桌面访问痕迹.使用windows系统自带的“远程桌面协助”mstsc进行远程,如果连接的用户多了,会留下访问的痕迹.虽然能带来方便,但是如果对于公用电脑来说,这些访 ...

  2. 【廖雪峰老师python教程】——装饰器

    装饰器 # 一个函数装饰器的列子 def log(func): def wrapper(*args,**kwargs): print('Name=%s'%func.__name__) return f ...

  3. GraphSAGE 代码解析(三) - aggregators.py

    原创文章-转载请注明出处哦.其他部分内容参见以下链接- GraphSAGE 代码解析(一) - unsupervised_train.py GraphSAGE 代码解析(二) - layers.py ...

  4. Python 进阶(一些进阶技巧)

    个人笔记,基本都摘抄自 Python3 官方文档 一. 上下文管理 1. 传统的类方式 Java 使用 try 来自动管理资源,只要实现了 AutoCloseable 接口,就可以部分摆脱手动 col ...

  5. BZOJ 1565 NOI2009 植物大战僵尸 topo+最小割(最大权闭合子图)

    题目链接:https://www.luogu.org/problemnew/show/P2805(bzoj那个实在是有点小小的辣眼睛...我就把洛谷的丢出来吧...) 题意概述:给出一张有向图,这张有 ...

  6. 【转】The best career advice I’ve received

    原文地址:http://www.nczonline.net/blog/2013/10/15/the-best-career-advice-ive-received/ I recently had an ...

  7. 平面最近点对(HDU 1007)

    题解:点击 #include <stdio.h> #include <string.h> #include <algorithm> #include <ios ...

  8. Week1 Team Homework #1 from Z.XML-总结学长经验教训

    谭传奇学长: 我们的弯路可能是,一开始没有从最基础的部分开始迭代开发,一开始就想的太远了一些,每一步开的有点太大了,所以可能有些东西最后就连不上,也没有能够按时完成.如果可以先做出一个能用的版本,然后 ...

  9. c# mysql blob数据类型

    1.采用stream流形式写入: #region 数据流转换成blob类型数据写入数据库 static public bool StreamToBlob(ref Stream stream, Odbc ...

  10. IDEA运行lambda表达式

    在idea写了一个lambda的测试例子,但是运行一直报错, public class LambdaTest { public static void main(String[] args) { ne ...