The TOP 500 most used php functions by CMS – Wordpress, Drupal, Magento and more

I worked for a while until I found the answer to the most used PHP functions in the most popular CMS, but the work was worth it. At least I got an idea of how PHP uses a server’s resources and possibly optimizing the use of those functions that “eat” most of the computing power!

The CMS considered were the following: Wordpress, Drupal, Magento, Vanilla, Bbpress, Phpbb3, Typo3, Joomla, Serendipity, Impresspages, Dotclear, Smf, Minibb, Mindtouch, Mediawiki, Docuwiki, Phpwiki, Pmpwiki… and The versions used were those from 2019-2020.

* I will return in a few subsequent posts with an individual statistic on CMS, a top 100 for the most used functions for each CMS.

RankFunctionCount%
1isset3944712.63
2empty182015.83
3sprintf129524.15
4count125724.03
5substr113423.63
6is_array87362.8
7implode74532.39
8unset73802.36
9strlen65722.1
10array_merge65462.1
11strpos62702.01
12explode61991.99
13str_replace61941.98
14in_array58581.88
15trim57851.85
16array_keys48531.55
17preg_match47401.52
18preg_replace38581.24
19strtolower37461.2
20htmlspecialchars37091.19
21dirname26860.86
22time24110.77
23list23750.76
24array_key_exists23430.75
25is_string21430.69
26array_map19260.62
27get_class17970.58
28file_exists17520.56
29array_values16500.53
30file_get_contents15790.51
31reset15720.5
32is_null15670.5
33is_object14870.48
34array_shift14720.47
35array_unique14330.46
36trigger_error13980.45
37function_exists13900.45
38array_filter13180.42
39defined13120.42
40json_encode13110.42
41intval13040.42
42date12940.41
43strtoupper12800.41
44chr12710.41
45is_numeric12340.4
46md512310.39
47serialize12280.39
48array_pop11980.38
49ord11600.37
50array_diff10850.35
51strtr9960.32
52define9700.31
53rtrim9270.3
54json_decode9060.29
55pack8970.29
56method_exists8820.28
57basename8730.28
58current8550.27
59max8390.27
60delete8230.26
61microtime8100.26
62func_get_args8100.26
63round8050.26
64unserialize7940.25
65ltrim7860.25
66call_user_func7790.25
67str_repeat7700.25
68strtotime7490.24
69preg_quote7230.23
70array_slice7210.23
71class_exists7060.23
72join7000.22
73min6870.22
74array_flip6790.22
75call_user_func_array6650.21
76realpath6630.21
77ini_get6570.21
78extract6410.21
79ucfirst6410.21
80unpack6360.2
81fopen6330.2
82base64_encode6290.2
83compact6080.19
84preg_split6020.19
85key5990.19
86is_dir5880.19
87preg_replace_callback5870.19
88parse_url5820.19
89array_search5780.19
90sizeof5680.18
91header5540.18
92version_compare5470.18
93end5420.17
94preg_match_all5360.17
95mt_rand5310.17
96floor5280.17
97exit5260.17
98fclose5200.17
99urlencode5160.17
100is_callable5150.16
101array_reverse5010.16
102fread4890.16
103assert4750.15
104sort4740.15
105strip_tags4580.15
106uniqid4540.15
107die4480.14
108ksort4430.14
109rand4380.14
110pathinfo4370.14
111array_intersect_key4360.14
112strrpos4340.14
113array_replace_recursive4320.14
114rawurlencode4210.13
115stripos4180.13
116array_unshift4110.13
117abs4090.13
118is_file4030.13
119array_intersect4000.13
120var_export4000.13
121hexdec3950.13
122fwrite3910.13
123ceil3840.12
124file_put_contents3750.12
125is_int3710.12
126str_pad3650.12
127next3570.11
128strstr3540.11
129array_diff_key3510.11
130printf3400.11
131substr_count3350.11
132gettype3280.11
133unlink3280.11
134addslashes3220.1
135base64_decode3180.1
136http_build_query3150.1
137print_r3090.1
138curl_setopt3010.1
139is_resource3010.1
140filesize3010.1
141gmdate3000.1
142mb_strtolower2980.1
143user_error2960.09
144array_combine2870.09
145strftime2860.09
146extension_loaded2860.09
147is_a2840.09
148strval2760.09
149array_column2740.09
150substr_replace2630.08
151strcasecmp2620.08
152range2570.08
153number_format2500.08
154fgets2480.08
155array_push2430.08
156is_bool2430.08
157urldecode2420.08
158file2380.08
159mb_substr2320.07
160sha12300.07
161ob_start2290.07
162array_merge_recursive2260.07
163echo2200.07
164iterator_to_array2200.07
165mb_strlen2200.07
166mkdir2190.07
167glob2160.07
168ini_set2090.07
169getenv2090.07
170array_replace2080.07
171array_walk2060.07
172get_object_vars2020.06
173flush1960.06
174hash1950.06
175ob_get_contents1930.06
176copy1920.06
177filemtime1900.06
178rewind1890.06
179ob_get_clean1870.06
180strncmp1830.06
181pow1830.06
182htmlspecialchars_decode1820.06
183ucwords1790.06
184nl2br1750.06
185filter_var1740.06
186array_splice1730.06
187rawurldecode1720.06
188uasort1710.05
189mktime1700.05
190property_exists1690.05
191parse_str1670.05
192usort1650.05
193fputs1640.05
194asort1640.05
195set_error_handler1640.05
196is_scalar1630.05
197log1610.05
198stripslashes1570.05
199error_reporting1550.05
200spl_object_hash1510.05
201strcmp1510.05
202is_writable1500.05
203array_fill_keys1500.05
204main1500.05
205rename1500.05
206html_entity_decode1490.05
207dechex1470.05
208ob_end_clean1450.05
209readdir1450.05
210chmod1440.05
211eval1430.05
212str_split1390.04
213debug_backtrace1370.04
214phpversion1370.04
215constant1360.04
216is_readable1340.04
217session_id1340.04
218strtok1320.04
219array_reduce1270.04
220strcspn1260.04
221array_fill1260.04
222bin2hex1260.04
223sleep1260.04
224htmlentities1260.04
225each1260.04
226restore_error_handler1250.04
227stristr1240.04
228getimagesize1230.04
229strspn1230.04
230is_subclass_of1190.04
231libxml_use_internal_errors1160.04
232setlocale1140.04
233exec1140.04
234iconv1130.04
235mb_convert_encoding1120.04
236array_change_key_case1120.04
237preg_grep1110.04
238mail1110.04
239tempnam1090.03
240simplexml_load_file1090.03
241touch1090.03
242imagesy1030.03
243strrev1010.03
244imagesx1010.03
245fseek1000.03
246clearstatcache1000.03
247escapeshellarg950.03
248array_chunk950.03
249strrchr950.03
250addcslashes940.03
251opendir940.03
252func_num_args930.03
253imagecreatetruecolor930.03
254imagecolorallocate910.03
255getcwd910.03
256lcfirst910.03
257memory_get_usage880.03
258feof870.03
259array_sum860.03
260scandir850.03
261floatval820.03
262func_get_arg810.03
263simplexml_load_string810.03
264stream_get_contents800.03
265flock800.03
266crypt800.03
267vsprintf800.03
268curl_exec790.03
269random_bytes790.03
270closedir790.03
271chdir780.02
272is_integer770.02
273curl_init770.02
274imagedestroy770.02
275mb_internal_encoding750.02
276curl_getinfo740.02
277ctype_digit720.02
278rmdir710.02
279is_float700.02
280ftell700.02
281utf8_decode690.02
282hash_hmac690.02
283array_pad690.02
284sys_get_temp_dir690.02
285get_class_methods670.02
286gmmktime660.02
287class_implements660.02
288imagefilledrectangle660.02
289random_int640.02
290crc32630.02
291interface_exists620.02
292mb_strtoupper620.02
293usleep620.02
294date_default_timezone_get610.02
295stat600.02
296stream_get_meta_data590.02
297imagealphablending590.02
298headers_sent590.02
299libxml_disable_entity_loader580.02
300utf8_encode580.02
301var_dump570.02
302json_last_error560.02
303spl_autoload_register560.02
304krsort550.02
305get_parent_class550.02
306chunk_split540.02
307token_get_all530.02
308array_diff_assoc530.02
309base_convert520.02
310imagesavealpha520.02
311setcookie510.02
312imagecopyresampled510.02
313fprintf500.02
314substr_compare500.02
315get_resource_type500.02
316fsockopen500.02
317xml_parser_create500.02
318ob_get_level490.02
319octdec480.02
320dir480.02
321mcrypt_generic_init480.02
322str_ireplace470.02
323date_format470.02
324curl_error470.02
325session_name460.01
326mb_strpos460.01
327php_uname460.01
328xmlrpc_server_register_method460.01
329curl_close450.01
330getmypid450.01
331set_time_limit440.01
332wordwrap440.01
333imagecolorallocatealpha440.01
334error_log440.01
335getdate430.01
336php_sapi_name430.01
337getSession430.01
338register_shutdown_function430.01
339mb_detect_encoding420.01
340ip2long420.01
341shell_exec420.01
342mysql_query420.01
343array_walk_recursive410.01
344gzinflate410.01
345print410.01
346decbin400.01
347date_default_timezone_set400.01
348fileperms390.01
349md5_file390.01
350hash_equals380.01
351uksort380.01
352is_link380.01
353spl_autoload_unregister380.01
354putenv380.01
355str_getcsv380.01
356error_get_last370.01
357iconv_strlen370.01
358curl_errno370.01
359stripcslashes370.01
360strnatcasecmp370.01
361mime_content_type360.01
362bindec360.01
363settype360.01
364srand360.01
365xml_parser_set_option350.01
366stream_context_create350.01
367date_create340.01
368get_called_class340.01
369session_write_close330.01
370move_uploaded_file330.01
371create_function320.01
372xml_get_error_code320.01
373link320.01
374socket_last_error320.01
375mcrypt_generic310.01
376array_multisort300.01
377oci_error290.01
378gzcompress290.01
379natcasesort290.01
380sqrt280.01
381session_start280.01
382json_last_error_msg280.01
383get_magic_quotes_gpc280.01
384fmod280.01
385imagepng270.01
386inet_pton270.01
387stream_resolve_include_path270.01
388proc_open270.01
389xml_parser_free260.01
390is_uploaded_file260.01
391arsort260.01
392socket_strerror260.01
393openssl_encrypt260.01
394readfile260.01
395imagecopy260.01
396expression250.01
397imagecolortransparent250.01
398stream_get_wrappers250.01
399mt_srand250.01
400ldap_search250.01
401openssl_random_pseudo_bytes250.01
402ldap_get_entries250.01
403mysql_real_escape_string250.01
404sha1_file250.01
405apcu_fetch240.01
406fstat240.01
407strncasecmp230.01
408array_rand230.01
409highlight_string230.01
410stream_set_timeout230.01
411class_alias230.01
412gzuncompress230.01
413mysql_error230.01
414fputcsv230.01
415is_writeable230.01
416memory_get_peak_usage220.01
417xml_error_string220.01
418gettext220.01
419split220.01
420set_exception_handler220.01
421escapeshellcmd220.01
422spl_autoload_functions210.01
423Locale::getDefault210.01
424xml_set_element_handler210.01
425strpbrk210.01
426stream_select210.01
427ctype_alpha210.01
428get_html_translation_table210.01
429ob_get_length200.01
430sin200.01
431fgetcsv200.01
432imagejpeg200.01
433decoct200.01
434imagefill200.01
435imagecreate200.01
436pg_escape_string200.01
437ignore_user_abort190.01
438mcrypt_create_iv190.01
439is_executable190.01
440gzdeflate190.01
441session_status190.01
442levenshtein190.01
443xml_get_current_line_number190.01
444imagecolorsforindex190.01
445gmp_init190.01
446get_magic_quotes_runtime190.01
447iterator_count190.01
448checkdate190.01
449timezone_identifiers_list190.01
450get_defined_constants190.01
451sqlsrv_errors190.01
452mb_convert_case190.01
453xml_set_character_data_handler190.01
454ftruncate190.01
455imagecreatefrompng180.01
456timezone_open180.01
457session_regenerate_id180.01
458iconv_substr180.01
459popen180.01
460apc_store180.01
461gethostname180.01
462curl_setopt_array180.01
463proc_close180.01
464strripos180.01
465dl180.01
466imagerotate180.01
467mb_check_encoding180.01
468mcrypt_module_open180.01
469date_parse170.01
470fileowner170.01
471gmstrftime170.01
472mb_strrpos170.01
473mb_strwidth170.01
474libxml_clear_errors170.01
475restore_exception_handler170.01
476mt_getrandmax170.01
477ereg170.01
478mhash170.01
479fgetc170.01
480grapheme_strlen170.01
481posix_getpwuid170.01
482bcmul170.01
483apcu_store160.01
484dbx_error160.01
485set_magic_quotes_runtime160.01
486fflush160.01
487array_count_values160.01
488openssl_error_string160.01
489gethostbyname160.01
490natsort160.01
491ldap_error160.01
492symlink160.01
493apcu_delete160.01
494stream_socket_client15
495get_declared_classes15
496apc_fetch15
497passthru15
498ob_clean15
499rsort15
500mb_stripos15
byrev Written by:

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *