Skip to content

The most frequently used PHP functions on GitHub

While preparing the April meetup of the PHP User Group Rheinhessen, Christian came up with an idea: Let's take a look at one of the least used and most "exotic" internal functions of PHP and discuss them. Soon, the question arose, "which functions are only infrequently used?" - A: "Let's take a look at PHP repos on Github!"

After studying Github's Search API, it soon became clear that it's not possible to search all PHP repositories for functions this way. What I had to do was to write a simple crawler that POSTed search queries to the search form on the Github website (while respecting the rate limit, of course).

The results were parsed and saved to a JSON file, and I built a bar chart that visualizes the collected data:

Screenshot of where the findings are presented

Results & Findings

This approach has some limitations. For example, the most frequent function, file(), is used almost twice as much as the runner-up, link(). On closer inspection, however, we found that our search query also returned results containing the __FILE__ magic constant, comments containing the word "file" and other occurrences of this quite common English term.

Other functions, e.g. intlcal_* were rarely found; we suspect that most of the time the IntlCalendar class is used instead. So while we the results are not super accurate, they convey a general picture of the frequency of function usage.

We aimed at finding uncommon functions that are useful all the same. The following list is not exhaustive, but interesting, and might serve as inspiration for your next project:

  • IntlCalendar: builds on the ICU's Calendar API
  • ResourceBundle: implements access to ICU resource data files. These files are binary data arrays which ICU uses to store the localized data.
  • PCNTL functions: implements the Unix style of process creation, program execution, signal handling and process termination
  • Mailparse functions: Mailparse is an extension for parsing and working with email messages.
  • Socket functions: The socket extension implements a low-level interface to the socket communication functions based on the popular BSD sockets, providing the possibility to act as a socket server as well as a client.
  • NumberFormatter: By invoking the methods provided by the NumberFormatter class, you can format numbers, currencies, and percentages according to the specified or default locale.


If you want to discuss the findings and the functions, and generally want to meet nice people and have interesting disucssions, why not join the next meetup of our PHP User Group Rheinhessen (or any other User Group close to you)? You're also invited to play around with the results or the project itself (it's on GitHub).


Netz - Rettung - Recht am : Wellenreiten 03/2015

Vorschau anzeigen
Wer als “Websurfer” metaphorisch auf den Wellen des Netzes reitet, findet dabei zwar keine paradiesischen Inseln, manchmal aber immerhin ganz interessante Lektüre. Im März 2015 kann ich u.a. folgende Fundstücke empfehlen und der werten Leserschaft ans He


Ansicht der Kommentare: Linear | Verschachtelt

Noch keine Kommentare

Kommentar schreiben

Markdown-Formatierung erlaubt
Wenn Du Deinen Twitter Namen eingibst wird Deine Timeline in Deinem Kommentar verlinkt.
Bewirb einen Deiner letzten Artikel
Dieses Blog erlaubt Dir mit Deinem Kommentar einen Deiner letzten Artikel zu bewerben. Bitte gib Deine Blog URL als Homepage ein, dann wird eine Auswahl erscheinen, in der Du einen Artikel auswählen kannst. (Javascript erforderlich)
Standard-Text Smilies wie :-) und ;-) werden zu Bildern konvertiert.
Die angegebene E-Mail-Adresse wird nicht dargestellt, sondern nur für eventuelle Benachrichtigungen verwendet.

Um maschinelle und automatische Übertragung von Spamkommentaren zu verhindern, bitte die Zeichenfolge im dargestellten Bild in der Eingabemaske eintragen. Nur wenn die Zeichenfolge richtig eingegeben wurde, kann der Kommentar angenommen werden. Bitte beachten Sie, dass Ihr Browser Cookies unterstützen muss, um dieses Verfahren anzuwenden.


Kommentare werden erst nach redaktioneller Prüfung freigeschaltet!