List of Most Commonly Used PHP Functions
2011/03/15 (1027 words)

One of the things about ranking in Search is that you need to consider all sorts of methods of working out what is relevent. Google broke new ground (although the idea had already existed) with its PageRank algorithm which supplied better search results then all the other search engines. For what I am doing however I need to consider what programmers are looking for. One thing that I considered some time ago was working out which are the most common functions in a language and adding this as an additional signal to ranking.

I couldn’t find anywhere else on the web with this question answered so I took my own approch. The method was to take a collection of large PHP projects, including, WordPress, Mambo, Sphider, Smarty, Drupal, CodeIgniter, dump all their source code into a single file stripped of comments, and then run some simple regex over this file counting the occurance of each function.

Of course the problem with that is for languages like Python with namespaces you need to build the first parts of a compiler/interpreter to work out the most commonly used functions and objects. PHP however traditionally has not had namespaces which makes it rather easy to pull apart and work out the most common functions.

The results of this can be found below.

<th>
  Function Name
</th>
<td>
  <a href="https://searchcode.com/?q=php%20array">array</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20isset">isset</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20define">define</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20empty">empty</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20assert">assert</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20file">file</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20end">end</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20count">count</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20date">date</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ord">ord</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20print">print</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20substr">substr</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20dir">dir</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20pos">pos</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20time">time</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20exp">exp</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20key">key</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20list">list</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20log">log</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20com">com</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20each">each</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20header">header</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_a">is_a</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20chr">chr</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20defined">defined</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20unset">unset</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20dl">dl</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_array">is_array</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strlen">strlen</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20tan">tan</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20link">link</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20str_replace">str_replace</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20printf">printf</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20in_array">in_array</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20trim">trim</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20die">die</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20sprintf">sprintf</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strpos">strpos</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20preg_match">preg_match</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20pi">pi</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20delete">delete</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20explode">explode</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20min">min</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20implode">implode</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strtolower">strtolower</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20preg_replace">preg_replace</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20exec">exec</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20intval">intval</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20file_exists">file_exists</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20dirname">dirname</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20htmlspecialchars">htmlspecialchars</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20stat">stat</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20sin">sin</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20current">current</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20mail">mail</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_null">is_null</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_merge">array_merge</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20trigger_error">trigger_error</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20pack">pack</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20eval">eval</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20function_exists">function_exists</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strtoupper">strtoupper</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20sizeof">sizeof</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_keys">array_keys</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_object">is_object</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20idate">idate</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20serialize">serialize</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20sort">sort</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20reset">reset</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_key_exists">array_key_exists</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_numeric">is_numeric</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20abs">abs</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20exit">exit</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20extract">extract</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_string">is_string</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20next">next</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20max">max</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20rand">rand</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20main">main</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20settype">settype</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20fclose">fclose</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20round">round</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20fopen">fopen</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_dir">is_dir</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20getopt">getopt</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20addslashes">addslashes</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20urlencode">urlencode</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20fread">fread</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20md5">md5</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20unlink">unlink</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20fwrite">fwrite</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20copy">copy</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20get_class">get_class</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20hash">hash</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20split">split</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_shift">array_shift</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20class_exists">class_exists</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20call_user_func">call_user_func</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20basename">basename</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_push">array_push</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20prev">prev</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20glob">glob</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_pop">array_pop</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strstr">strstr</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20gettext">gettext</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20gettype">gettype</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_file">is_file</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20mktime">mktime</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20join">join</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20stripslashes">stripslashes</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20floor">floor</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ini_get">ini_get</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ob_start">ob_start</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20flush">flush</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20unserialize">unserialize</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_values">array_values</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20file_get_contents">file_get_contents</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20preg_match_all">preg_match_all</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20constant">constant</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20gmdate">gmdate</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20chmod">chmod</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_map">array_map</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strrpos">strrpos</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20print_r">print_r</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strtotime">strtotime</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20method_exists">method_exists</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_readable">is_readable</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20filesize">filesize</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20microtime">microtime</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_unique">array_unique</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20system">system</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_int">is_int</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20mysql_query">mysql_query</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20str_repeat">str_repeat</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20func_get_arg">func_get_arg</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strip_tags">strip_tags</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20call_user_func_array">call_user_func_array</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ini_set">ini_set</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_slice">array_slice</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20range">range</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20fputs">fputs</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20preg_quote">preg_quote</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20getdate">getdate</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20mkdir">mkdir</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20func_get_args">func_get_args</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ucfirst">ucfirst</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20xml_parse">xml_parse</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20rename">rename</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strtr">strtr</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20preg_split">preg_split</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20mt_rand">mt_rand</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ceil">ceil</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20version_compare">version_compare</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_diff">array_diff</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20rtrim">rtrim</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20curl_setopt">curl_setopt</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ob_end_clean">ob_end_clean</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strftime">strftime</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_writable">is_writable</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20base64_encode">base64_encode</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20urldecode">urldecode</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20extension_loaded">extension_loaded</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ksort">ksort</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20stristr">stristr</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20error_log">error_log</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20realpath">realpath</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_search">array_search</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20crypt">crypt</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20substr_count">substr_count</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_bool">is_bool</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20configuration">configuration</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ftell">ftell</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20readdir">readdir</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20var_export">var_export</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20cos">cos</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20usage">usage</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20htmlentities">htmlentities</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20preg_replace_callback">preg_replace_callback</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20feof">feof</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20error_reporting">error_reporting</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20pow">pow</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20setcookie">setcookie</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_reverse">array_reverse</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20ob_get_contents">ob_get_contents</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20get_object_vars">get_object_vars</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20opendir">opendir</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20number_format">number_format</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20stripos">stripos</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20fgets">fgets</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20hexdec">hexdec</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20getenv">getenv</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20parse_url">parse_url</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20is_resource">is_resource</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20compact">compact</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strcmp">strcmp</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20filemtime">filemtime</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20sha1">sha1</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20array_unshift">array_unshift</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20get_current_user">get_current_user</a>
</td>
<td>
  <a href="https://searchcode.com/?q=php%20strrchr">strrchr</a>
</td>
<td>
  200 total
</td>