V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
fhy1994
V2EX  ›  程序员

推荐一个用 golang 实现 PHP 的常见内置函数的项目

  •  
  •   fhy1994 ·
    fanhengyuan · 2018-11-01 11:51:36 +08:00 · 3149 次点击
    这是一个创建于 2016 天前的主题,其中的信息可能已经有所发展或是发生改变。

    传送门:https://github.com/syyongx/php2go

    php2go

    Use Golang to implement PHP's common built-in functions. About 140+ functions have been implemented.

    Install

    go get github.com/syyongx/php2go
    

    PHP Functions

    Date/Time Functions

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

    String Functions

    strpos()
    stripos()
    strrpos()
    strripos()
    str_replace()
    ucfirst()
    lcfirst()
    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

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

    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_push()
    array_pop()
    array_unshift()
    array_shift()
    array_key_exists()
    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()
    pathinfo()
    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()
    disk_total_space()
    glob()
    umask()
    

    Variable handling Functions

    empty()
    is_numeric()
    

    Program execution Functions

    exec()
    system()
    passthru()
    

    Network Functions

    gethostname()
    gethostbyname()
    gethostbynamel()
    gethostbyaddr()
    ip2long()
    long2ip()
    

    Misc. Functions

    echo()
    uniqid()
    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.

    2 条回复    2018-11-06 18:08:24 +08:00
    daya
        1
    daya  
       2018-11-01 17:10:49 +08:00
    GO 版 PHP ?用 GO 再造 PHP ?一盘大棋?
    1069401249
        2
    1069401249  
       2018-11-06 18:08:24 +08:00
    ....吊得不行
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   970 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:33 · PVG 04:33 · LAX 13:33 · JFK 16:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.