Skip to content

Commit fbbb25b

Browse files
committed
readme en
1 parent 7e88071 commit fbbb25b

File tree

2 files changed

+127
-3
lines changed

2 files changed

+127
-3
lines changed

README.en.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# php2go
2+
3+
[![MIT licensed][3]][4]
4+
5+
[3]: https://img.shields.io/badge/license-MIT-blue.svg
6+
[4]: LICENSE
7+
8+
#### Introduce
9+
In the process of PHP to Golang,realize functions that are used frequently in some PHP code, making it easier and faster for PHPer to transform into Gopher!
10+
11+
#### README
12+
[README](https://github.com/lihao1988/php2go/blob/main/README.md)
13+
[README-en](https://github.com/lihao1988/php2go/blob/main/README.en.md)
14+
15+
#### Install
16+
```shell
17+
// github
18+
go get github.com/lihao1988/php2go
19+
20+
// gitee
21+
go get gitee.com/lihao1988/php2go
22+
```
23+
24+
## Requirements
25+
Go 1.15 or above.
26+
27+
## PHP Function
28+
### Array(Slice/Map) Functions
29+
```php
30+
## import array
31+
32+
In() [PHP:in_array(),Checks if a value exists in an array]
33+
Keys() [PHP:array_keys(),Return all the keys or a subset of the keys of an array]
34+
Values() [PHP:array_values(),Return all the values of an array]
35+
Merge() [PHP:array_merge(),Merge one or more arrays]
36+
Unique() [PHP:array_unique(),Removes duplicate values from an array]
37+
Column() [PHP:array_column(),Return the values from a single column in the input array]
38+
Diff() [PHP:array_diff(),Computes the difference of arrays]
39+
Intersect() [PHP:array_intersect(),Computes the intersection of arrays]
40+
```
41+
### Crypto Functions
42+
```php
43+
## import crypto
44+
45+
MD5() [PHP:md5(),Calculate the md5 hash of a string]
46+
Sha1() [PHP:sha1(),Calculate the sha1 hash of a string]
47+
Base64Encode() [PHP:base64_encode(),Encodes data with MIME base64]
48+
Base64Decode() [PHP:base64_decode(),Decodes data encoded with MIME base64]
49+
```
50+
### Date/Time Functions
51+
```php
52+
## import datetime
53+
54+
Time() [PHP:time(),Return current Unix timestamp]
55+
StrToTime() [PHP:strtotime(),Parse about any English textual datetime description into a Unix timestamp]
56+
Date() [PHP:date(),Format a Unix timestamp]
57+
CheckDate() [PHP:checkdate(),Validate a Gregorian date]
58+
Sleep() [PHP:sleep(),Delay execution]
59+
Usleep() [PHP:usleep(),Delay execution in microseconds]
60+
```
61+
### Filesystem Functions
62+
```php
63+
## import file
64+
65+
Basename() [PHP:basename(),Returns trailing name component of path]
66+
Dirname() [PHP:dirname(),Returns a parent directory's path]
67+
Filesize() [PHP:filesize(),Gets file size]
68+
PathInfo() [PHP:pathinfo(),Returns information about a file path]
69+
FileExists() [PHP:file_exists(),Checks whether a file or directory exists]
70+
IsDir() [PHP:is_dir(),Tells whether the filename is a directory]
71+
IsFile() [PHP:is_file(),Tells whether the filename is a regular file]
72+
FileGetContents() [PHP:file_get_contents(),Reads entire file into a string]
73+
FilePutContents() [PHP:file_put_contents(),Write data to a file]
74+
Chmod() [PHP:chmod(),Changes file mode]
75+
Chown() [PHP:chown(),Changes file owner]
76+
```
77+
### Math Functions
78+
```php
79+
## import math
80+
81+
Abs() [PHP:abs(),Absolute value]
82+
Round() [PHP:round(),Rounds a float]
83+
Floor() [PHP:floor(),Round fractions down]
84+
Ceil() [PHP:ceil(),Round fractions up]
85+
Max() [PHP:max(),Find highest value]
86+
Min() [PHP:min(),Find lowest value]
87+
DecBin() [PHP:decbin(),Decimal to binary]
88+
DecHex() [PHP:dechex(),Decimal to hexadecimal]
89+
```
90+
### String Functions
91+
```php
92+
## import string
93+
94+
StrLen() [PHP:strlen(),Get string length]
95+
MbStrLen() [PHP:mb_strlen(),Get string length by UTF-8]
96+
SubstrCount() [PHP:substr_count(),Count the number of substring occurrences]
97+
Substr() [PHP:substr(),Return part of a string]
98+
MbSubstr() [PHP:mb_substr(),Get part of string by UTF-8]
99+
StrPos() [PHP:strpos(),Find the position of the first occurrence of a substring in a string]
100+
StrRPos() [PHP:strrpos(),Find the position of the last occurrence of a substring in a string]
101+
StrSplit() [PHP:str_split(),Convert a string to an array]
102+
UCFirst() [PHP:ucfirst(),Make a string's first character uppercase]
103+
```
104+
### URL Functions
105+
```php
106+
## import url
107+
108+
ParseUrl() [PHP:parse_url(),Parse a URL and return its components]
109+
UrlEncode() [PHP:urlencode(),URL-encodes string]
110+
UrlDecode() [PHP:urldecode(),Decodes URL-encoded string]
111+
RawUrlEncode() [PHP:rawurlencode(),URL-encode according to RFC 3986]
112+
RawUrlDecode() [PHP:rawurldecode(),Decode URL-encoded strings]
113+
HttpBuildQuery() [PHP:http_build_query(),Generate URL-encoded query string]
114+
```
115+
116+
## LICENSE
117+
PHP2Go source code is licensed under the [MIT](https://github.com/lihao1988/php2go/blob/main/LICENSE) Licence.

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
#### 介绍
99
PHP 转行到 Golang 过程中,实现部分 PHP 代码中使用频率较高的函数,让 PHPer 蜕变为 Gopher 更简单、更快捷!
1010

11+
#### README
12+
[README](https://github.com/lihao1988/php2go/blob/main/README.md)
13+
[README-en](https://github.com/lihao1988/php2go/blob/main/README.en.md)
14+
1115
#### 安装
1216
```shell
17+
// github
1318
go get github.com/lihao1988/php2go
14-
```
15-
16-
```shell
19+
20+
// gitee
1721
go get gitee.com/lihao1988/php2go
1822
```
1923

@@ -73,6 +77,7 @@ Chown() [PHP:chown(),改变文件所有者]
7377
### Math Functions
7478
```php
7579
## import math
80+
7681
Abs() [PHP:abs(),绝对值]
7782
Round() [PHP:round(),对浮点数进行四舍五入]
7883
Floor() [PHP:floor(),向下舍入为最接近的整数]
@@ -85,6 +90,7 @@ DecHex() [PHP:dechex(),把十进制转换为十六进制]
8590
### String Functions
8691
```php
8792
## import string
93+
8894
StrLen() [PHP:strlen(),获取字符串长度]
8995
MbStrLen() [PHP:mb_strlen(),按照 UTF-8 获取字符串的长度]
9096
SubstrCount() [PHP:substr_count(),计算字串出现的次数]
@@ -98,6 +104,7 @@ UCFirst() [PHP:ucfirst(),将字符串的首字母转换为大写]
98104
### URL Functions
99105
```php
100106
## import url
107+
101108
ParseUrl() [PHP:parse_url(),解析 URL,返回其组成部分]
102109
UrlEncode() [PHP:urlencode(),编码 URL 字符串]
103110
UrlDecode() [PHP:urldecode(),解码已编码的 URL 字符串]

0 commit comments

Comments
 (0)