This is a foreign language, translated for you. The author analyzed the use of PHP functions in more than 1,900 projects and found the following results. While it is possible that the most common ones are not in this list, we recommend that PHP beginners study these functions carefully.

The original link: https://www.exakat.io/top-100-php-functions/

Here we present the 100 most frequently used PHP native functions, labeled from 1 to 100, based on our code analysis of 1,900 open source PHP projects using the PHP static Analysis tool.

Top100

1 count 81.41% 147.67
2 is_array 77.32% 117.86
3 substr 74.62% 142.92
4 in_array 74.16% 79.55
5 explode 73.19% 71.51
6 str_replace 72.32% 101.05
7 implode 72.27% 66.59
8 strlen 70.07% 98.32
9 array_merge 69.46% 64.01
10 strpos 67.98% 78.18
11 preg_match 67.31% 76.60
12 sprintf 67.16% 119.46
13 trim 66.75% 81.28
14 strtolower 65.99% 59.62
15 file_exists 65.12% 45.13
16 is_string 61.39% 45.10
17 preg_replace 60.27% 54.28
18 file_get_contents 59.96% 20.71
19 array_key_exists 59.70% 57.50
20 array_keys 59.35% 39.59
21 dirname 56.44% 54.84
22 function_exists 53.58% 42.62
23 array_map 53.22% 19.45
24 get_class 53.12% 33.07
25 class_exists 52.50% 23.13
26 is_object 51.94% 35.35
27 time 51.79% 41.42
28 json_encode 51.48% 24.81
29 date 50.72% 52.18
30 is_null 49.69% 60.52
31 is_numeric 49.49% 40.69
32 array_shift 49.49% 23.28
33 defined 48.72% 86.82
34 is_dir 48.57% 22.86
35 json_decode 48.42% 17.39
36 header 48.16% 59.71
37 strtoupper 47.80% 30.95
38 array_values 47.24% 17.27
39 md5 46.88% 23.74
40 method_exists 46.73% 19.05
41 file_put_contents 46.68% 12.49
42 rtrim 45.91% 18.08
43 array_pop 45.51% 20.60
44 unlink 44.59% 23.55
45 basename 44.59% 27.23
46 realpath 44.08% 15.90
47 call_user_func 43.97% 16.41
48 call_user_func_array 43.92% 18.40
49 fopen 43.77% 25.61
50 microtime 43.46% 14.41
51 fclose 42.85% 28.36
52 is_int 42.75% 15.78
53 is_file 42.08% 20.52
54 array_slice 41.83% 13.20
55 preg_match_all 40.55% 14.66
56 ucfirst 40.25% 17.02
57 intval 40.19% 88.13
58 str_repeat 40.14% 19.51
59 serialize 40.14% 22.05
60 array_filter 39.99% 13.87
61 mkdir 39.79% 11.17
62 is_callable 39.43% 11.94
63 ltrim 39.17% 10.90
64 ob_start 39.12% 13.26
65 round 39.07% 28.56
66 fwrite 38.97% 23.39
67 array_unique 38.87% 15.96
68 array_search 38.82% 14.19
69 reset 38.71% 20.79
70 array_unshift 38.10% 10.32
71 parse_url 37.90% 9.61
72 func_get_args 37.79% 28.33
73 end 37.49% 12.70
74 base64_encode 37.39% 14.15
75 unserialize 37.18% 18.35
76 max 36.98% 22.88
77 preg_split 36.98% 13.27
78 gettype 36.93% 16.16
79 strrpos 36.67% 11.95
80 version_compare 36.67% 14.87
81 array_push 36.67% 26.18
82 floor 36.11% 18.78
83 strtotime 36.01% 27.94
84 htmlspecialchars 35.96% 51.08
85 ini_get 35.85% 19.25
86 ini_set 35.60% 14.49
87 chr 35.34% 186.97
88 extension_loaded 35.29% 14.17
89 is_bool 35.24% 11.44
90 ksort 34.98% 10.82
91 array_reverse 34.93% 8.27
92 ord 34.73% 53.17
93 uniqid 34.68% 9.83
94 strtr 34.47% 12.90
95 array_diff 34.32% 11.13
96 error_reporting 34.17% 8.99
97 ceil 33.35% 11.99
98 urlencode 33.30% 29.63
99 min 32.69% 18.31
100 print_r 32.64% 14.12

Analysis of the

  • The most common PHP functions are string functions, then arrays, then files.
  • Click on the link for each function to take a closer look at its documentation, such as the second argument to the count function, to get a better understanding of these functions.
  • The above 100 functions have no immediate plans to be discarded.
  • Among non-built-in libraries, MBString ranks first, curl second, followed by GD, Filter, and Iconv.
  • Md5 still ranks first among encryption functions, followed by Sha1.
  • Array, Echo, print, Empty, and isset are not included in this ranking, and they are definitely highly used.
  • Database operations are not included in this ranking.
  • PHP, in files, reads files much more than it writes them.
  • Use key sort more often than value sort.

summary

Generally speaking, I do not like ranking class articles, the main reason for the summary of the translation of this article is that the above functions are every PHP beginners must be able to, as a list of commonly used functions, each function can be clicked directly to the document, if you are not familiar with, please seriously study.