Table of Contents
Top 100 Analysis
Postscript
Home headlines Ranking of the 100 most commonly used PHP functions

Ranking of the 100 most commonly used PHP functions

Jun 17, 2019 pm 06:16 PM
php function Commonly used

The following list is the top 100 most commonly used PHP functions: they are the most commonly used functions that come with PHP.

Ranking of the 100 most commonly used PHP functions

#The functions are named and ordered from 1 to 100. The other 4500 functions are not currently ranked. The following frequency list represents how often this function is used in PHP code: References come from 1900 PHP open source projects.

They used Exakat static analysis engine version 1.2.5 of the static analysis engine for the review. The average is the number of times this function is called in a project. Some functions are used by wrappers, while others are main functions.

For example, 4 out of 5 projects use the count function, and the function is called about 150 times. It shows that it is very popular and widely used.

Click on the function name to jump to related Analysis and examples. There are some summary insights at the bottom of the Top 100 article.

##672.32 %101.057##implode898.32964.011078.18preg_matchsprintftrimstrtolowerfile_existsis_string##17preg_replace60.27 %18file_get_contents59.96 %19array_key_exists59.70 %20array_keys59.35 %21dirname56.44 %function_existsarray_mapget_classclass_existsis_objecttimejson_encode
Ranking Function Frequency Average
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
str_replace
72.27 % 66.59
##strlen 70.07 %
array_merge 69.46 %
strpos 67.98 % ##11
67.31 %76.60 12
67.16 % 119.46 13
66.75 %81.28 14
65.99 %59.62 15
65.12 %45.13 16
61.39 %45.10
54.28
20.71
57.50
39.59
54.84 ##22
53.58 % 42.62 23
53.22 % 19.45 24
53.12 % 33.07 25
52.50 % 23.13 26
51.94 % 35.35 27
51.79 % 41.42 28
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

Top 100 Analysis

  • The most commonly used PHP functions are string functions, followed by array functions, followed by file functions. (Operation functions are not listed here mainly because they are usually based on operators)

  • The link for each function points to its corresponding documentation. In fact, many functions have been developed and received many new features. Properties, such as: the second parameter of count(), the second parameter of dirname(), and preg_match() and str_replace() Accepts arrays as parameters, etc. There are many easter eggs.

  • The above 100 functions have no plans to be abandoned in the near future.

  • Among the non-built-in libraries, mbstring ranks first, curl second, followed by gd, filter and iconv.

  • md5 is the most commonly used encryption function, followed by Sha1 (#147).

  • print_r appears somewhere in 1/3 of the project codes, anywhere...

  • Due to dirname(dirname(dirname())) is called, dirname is used very frequently.

  • arrayechoprintemptyisset These are not included in this ranking, their usage is definitely very high.

  • The following functions should be replaced by operators: array_push, is_object, func_get_arg, chr , call_user_func.

  • Quite a few calls are made to know the type of the value.

  • Database functions are not ranked here: they use classes frequently, but the functionality is still frequent. Maybe another top 100?

  • PHP is more used for reading files than writing files. It also decodes base64.

  • Sort by key more often than by value or by key.

  • Usually use file_get_contents to read files and fwrite to write files.

Postscript

If you are learning PHP, it’s a good idea to review the 100 features ranked here. They're the features you'll find most often when you join a coding team. They're not unique, but you'll be less surprised when you encounter them.

Recommended related PHP video tutorials: "PHP Video Tutorial"

Related articles:

Commonly used in php Detailed summary of more than 100 functions (with code)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to optimize the lazy loading effect of images through php functions? How to optimize the lazy loading effect of images through php functions? Oct 05, 2023 pm 12:13 PM

How to optimize the lazy loading effect of images through PHP functions? With the development of the Internet, the number of images in web pages is increasing, which puts pressure on page loading speed. In order to improve user experience and reduce loading time, we can use image lazy loading technology. Lazy loading of images can delay the loading of images. Images are only loaded when the user scrolls to the visible area, which can reduce the loading time of the page and improve the user experience. When writing PHP web pages, we can optimize the lazy loading effect of images by writing some functions. Details below

How to reduce memory usage through php functions? How to reduce memory usage through php functions? Oct 05, 2023 pm 01:45 PM

How to reduce memory usage through PHP functions. In development, memory usage is a very important consideration. If a large amount of memory is used in a program, it may cause slowdowns or even program crashes. Therefore, reasonably managing and reducing memory usage is an issue that every PHP developer should pay attention to. This article will introduce some methods to reduce memory usage through PHP functions, and provide specific code examples for readers' reference. Use the unset() function to release variables in PHP. When a variable is no longer needed, use

Spring Annotation Revealed: Analysis of Common Annotations Spring Annotation Revealed: Analysis of Common Annotations Dec 30, 2023 am 11:28 AM

Spring is an open source framework that provides many annotations to simplify and enhance Java development. This article will explain commonly used Spring annotations in detail and provide specific code examples. @Autowired: Autowired @Autowired annotation can be used to automatically wire beans in the Spring container. When we use the @Autowired annotation where dependencies are required, Spring will find matching beans in the container and automatically inject them. The sample code is as follows: @Auto

Learn the canvas framework and explain the commonly used canvas framework in detail Learn the canvas framework and explain the commonly used canvas framework in detail Jan 17, 2024 am 11:03 AM

Explore the Canvas framework: To understand what are the commonly used Canvas frameworks, specific code examples are required. Introduction: Canvas is a drawing API provided in HTML5, through which we can achieve rich graphics and animation effects. In order to improve the efficiency and convenience of drawing, many developers have developed different Canvas frameworks. This article will introduce some commonly used Canvas frameworks and provide specific code examples to help readers gain a deeper understanding of how to use these frameworks. 1. EaselJS framework Ea

Summary of methods for implementing image editing and processing functions using PHP image processing functions Summary of methods for implementing image editing and processing functions using PHP image processing functions Nov 20, 2023 pm 12:31 PM

PHP image processing functions are a set of functions specifically used to process and edit images. They provide developers with rich image processing functions. Through these functions, developers can implement operations such as cropping, scaling, rotating, and adding watermarks to images to meet different image processing needs. First, I will introduce how to use PHP image processing functions to achieve image cropping function. PHP provides the imagecrop() function, which can be used to crop images. By passing the coordinates and size of the cropping area, we can crop the image

Introduction to PHP functions: strtr() function Introduction to PHP functions: strtr() function Nov 03, 2023 pm 12:15 PM

PHP function introduction: strtr() function In PHP programming, the strtr() function is a very useful string replacement function. It is used to replace specified characters or strings in a string with other characters or strings. This article will introduce the usage of strtr() function and give some specific code examples. The basic syntax of the strtr() function is as follows: strtr(string$str, array$replace) where $str is the original word to be replaced.

Comparing PHP functions to functions in other languages Comparing PHP functions to functions in other languages Apr 10, 2024 am 10:03 AM

PHP functions have similarities with functions in other languages, but also have some unique features. Syntactically, PHP functions are declared with function, JavaScript is declared with function, and Python is declared with def. In terms of parameters and return values, PHP functions accept parameters and return a value. JavaScript and Python also have similar functions, but the syntax is different. In terms of scope, functions in PHP, JavaScript and Python all have global or local scope. Global functions can be accessed from anywhere, and local functions can only be accessed within their declaration scope.

How performant are PHP functions? How performant are PHP functions? Apr 18, 2024 pm 06:45 PM

The performance of different PHP functions is crucial to application efficiency. Functions with better performance include echo and print, while functions such as str_replace, array_merge, and file_get_contents have slower performance. For example, the str_replace function is used to replace strings and has moderate performance, while the sprintf function is used to format strings. Performance analysis shows that it only takes 0.05 milliseconds to execute one example, proving that the function performs well. Therefore, using functions wisely can lead to faster and more efficient applications.