Which PHP Functions Should you Learn?

Most people know that PHP has _a lot _of functions but how many do you think there are? I spent a little while trying to work this out and after some judicious Googling, I came up with several answers.

  • In 2010, there were apparently 5,701 php functions.
  • If you run this code and echo out a count of the internal functions, you get 1,333.
  • This PHP function list page on the PHP.net website has approximately 10,919.

What’s the right answer and how many of them should you learn, if any? I still don’t really know :-) But, that brings me to a really interesting web page I came across at exakat.io which has performed some static analysis on a large number of open source PHP projects. They state that there are about 4,600 functions but that might just be a count of the used functions in their analysis, rather than existing functions. Anyway, the results are really intriguing. If you visit that site, you can see the top 100 used functions based on frequency of use in other projects and how many times they are used, on average, within a project.

Firstly, as they state, this is a great list for you to focus on when learning PHP. Many of those top 100 functions will end up being ones you will need to know, most likely. Moreover, against each is a link to the help page which makes that much easier to see what the function does. Secondly, I noticed that md5 is used far too much. If you need to use hashing for passwords, despite md5’s apparent popularity, make sure you are using more secure methods, instead. Lastly, one small thing I noticed was that chr is used the most within projects of the top 100, yet is number 87 on the list.

Rank Function Frequency Average
87 chr 35.34 % 186.97

Anyone know why? Hope you find that interesting, regardless.


Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com