Are you looking for an overview of the most important PHP functions? Look no further! In this article, we present the top 100 PHP functions that are widely used. These functions are crucial within the PHP language itself and are regularly applied in various projects.
These functions were not chosen randomly. They have been carefully named and ranked from 1 to 100 based on their relevance and popularity. Additionally, we have another 4500 functions that are not ranked.
To indicate the frequency of these functions in PHP code repositories, we rely on an extensive reference corpus consisting of a list of 2500 PHP Open Source projects. This includes the top 1000 composer packages, public repositories on platforms like GitHub, GitLab, and Gitee, as well as downloaded archives. This provides you with a good understanding of how often these functions are actually used. (Source: https://github.com/BaseMax/TopPHPFunctions)
Mastering these 100 PHP functions is invaluable for any developer working with PHP. They form the building blocks for writing efficient and reliable code. Whether you are a beginner looking to learn the fundamentals of PHP or an experienced developer aiming to expand your knowledge, understanding and mastering these 100 functions will undoubtedly elevate your development skills to a higher level.
Prepare to strengthen your PHP skills with this indispensable set of 100 features. It will help you write better code, work more efficiently and take your projects to new heights.
PHP Functions
Rank | Function | Frequency | Average | PHP Manual |
---|---|---|---|---|
1 | file_exists | 62.80% | 13 | file_exists |
2 | str_replace | 58.20% | 33 | str_replace |
3 | implode | 57.31% | 35 | implode |
4 | count | 56.42% | 61 | count |
5 | dirname | 56.38% | 13 | dirname |
6 | substr | 55.84% | 53 | substr |
7 | sprintf | 55.26% | 80 | sprintf |
8 | strpos | 55.07% | 24 | strpos |
9 | array_merge | 54.80% | 35 | array_merge |
10 | in_array | 51.39% | 33 | in_array |
11 | explode | 51.35% | 26 | explode |
12 | strlen | 50.97% | 35 | strlen |
13 | is_array | 50.73% | 46 | is_array |
14 | array_key_exists | 49.54% | 28 | array_key_exists |
15 | array_keys | 49.27% | 16 | array_keys |
16 | preg_match | 46.52% | 28 | preg_match |
17 | file_get_contents | 46.48% | 8 | file_get_contents |
18 | is_file | 44.43% | 6 | is_file |
19 | array_values | 42.81% | 7 | array_values |
20 | file_put_contents | 42.46% | 4 | file_put_contents |
21 | trim | 41.57% | 25 | trim |
22 | method_exists | 41.49% | 8 | method_exists |
23 | defined | 40.87% | 19 | defined |
24 | is_string | 40.76% | 20 | is_string |
25 | function_exists | 40.29% | 20 | function_exists |
26 | array_map | 39.33% | 12 | array_map |
27 | preg_replace | 39.02% | 17 | preg_replace |
28 | strtolower | 38.94% | 19 | strtolower |
29 | is_dir | 38.67% | 6 | is_dir |
30 | strtr | 38.01% | 5 | strtr |
31 | call_user_func | 37.01% | 4 | call_user_func |
32 | strrpos | 36.70% | 4 | strrpos |
33 | call_user_func_array | 36.43% | 3 | call_user_func_array |
34 | array_flip | 35.89% | 2 | array_flip |
35 | fwrite | 35.89% | 4 | fwrite |
36 | rtrim | 35.69% | 6 | rtrim |
37 | filter_var | 35.65% | 2 | filter_var |
38 | ini_get | 35.15% | 5 | ini_get |
39 | json_decode | 34.76% | 7 | json_decode |
40 | array_filter | 34.76% | 7 | array_filter |
41 | realpath | 34.15% | 4 | realpath |
42 | header | 34.07% | 7 | header |
43 | class_exists | 34.03% | 12 | class_exists |
44 | json_encode | 33.49% | 9 | json_encode |
45 | trigger_error | 32.95% | 5 | trigger_error |
46 | get_class | 32.95% | 13 | get_class |
47 | spl_autoload_register | 32.10% | 1 | spl_autoload_register |
48 | unlink | 30.43% | 5 | unlink |
49 | headers_sent | 29.78% | 1 | headers_sent |
50 | is_object | 29.31% | 11 | is_object |
51 | mkdir | 29.20% | 2 | mkdir |
52 | array_shift | 28.69% | 6 | array_shift |
53 | spl_autoload_unregister | 28.54% | 1 | spl_autoload_unregister |
54 | apcu_fetch | 28.23% | 0 | apcu_fetch |
55 | array_pop | 28.11% | 5 | array_pop |
56 | stream_resolve_include_path | 27.84% | 0 | stream_resolve_include_path |
57 | is_int | 27.65% | 5 | is_int |
58 | apcu_add | 27.57% | 0 | apcu_add |
59 | getcwd | 27.49% | 1 | getcwd |
60 | chdir | 27.49% | 0 | chdir |
61 | strtoupper | 27.42% | 6 | strtoupper |
62 | is_numeric | 26.95% | 9 | is_numeric |
63 | array_unique | 26.91% | 4 | array_unique |
64 | ltrim | 26.60% | 4 | ltrim |
65 | basename | 26.57% | 4 | basename |
66 | str_repeat | 26.26% | 7 | str_repeat |
67 | fopen | 25.91% | 6 | fopen |
68 | array_slice | 24.94% | 3 | array_slice |
69 | getenv | 24.94% | 4 | getenv |
70 | var_export | 24.71% | 3 | var_export |
71 | preg_match_all | 24.67% | 3 | preg_match_all |
72 | is_callable | 24.48% | 4 | is_callable |
73 | reset | 24.44% | 4 | reset |
74 | preg_split | 24.40% | 3 | preg_split |
75 | fclose | 24.36% | 5 | fclose |
76 | array_unshift | 24.25% | 3 | array_unshift |
77 | gettype | 24.21% | 4 | gettype |
78 | end | 23.90% | 3 | end |
79 | array_search | 23.82% | 3 | array_search |
80 | max | 23.78% | 5 | max |
81 | extension_loaded | 23.59% | 3 | extension_loaded |
82 | is_bool | 23.55% | 2 | is_bool |
83 | version_compare | 22.82% | 3 | version_compare |
84 | preg_quote | 22.78% | 3 | preg_quote |
85 | time | 22.70% | 9 | time |
86 | ucfirst | 22.66% | 4 | ucfirst |
87 | ksort | 22.66% | 2 | ksort |
88 | preg_replace_callback | 22.54% | 3 | preg_replace_callback |
89 | md5 | 22.51% | 4 | md5 |
90 | array_reverse | 22.47% | 2 | array_reverse |
91 | array_diff | 22.12% | 2 | array_diff |
92 | is_readable | 22.00% | 1 | is_readable |
93 | microtime | 21.96% | 4 | microtime |
94 | copy | 21.81% | 1 | copy |
95 | parse_url | 21.81% | 2 | parse_url |
96 | is_null | 21.50% | 17 | is_null |
97 | base64_encode | 21.42% | 3 | base64_encode |
98 | current | 21.38% | 2 | current |
99 | is_resource | 21.08% | 3 | is_resource |
100 | serialize | 20.77% | 4 | serialize |