Crypto Notes

Can we use PHP for machine learning?

This article is rated as standard to read using the Flesch-Kincaid reading ease scale.

This article should take around 2 minutes 57 seconds to read.

In response to a question asked on a facebook group…

The simple answer is, yes you can. but before I explain how, I need to give a quick explanation of what “Machine learning” or “Artificial Intelligence” is.

At its heart “Machine learning” isn’t magic, it isn’t a black art, it is a set of algorithms which used mathematical functions which can be used to look for patterns in data.

Imagine you have two groups each containing a number of items.



and you have a single number you know belongs in one of the two groups but your not sure which one


Which group do you think the number belongs in? The first set contains mostly lower numbers and the second set mostly numbers above seven. So it’s likely that the item belongs in set one.

Automate this and you have machine learning.

Machine learning, therefore, can be implemented in almost any language, you just need to implement the relevant algorithms.

Sadly for all but trivial cases, such algorithms are hard to implement.

Thankfully Microsoft, Google, and Amazon all have API that can be used to implement Artificial Intelligence within your own applications.

Since all the API are web-based they can be accessed by any application which can make web-based calls, and so PHP can be used with the API’s.

Microsoft has five main types of cognitive services.

  • Vision – Image-processing algorithms to smartly identify, caption and moderate your pictures.
  • Knowledge – Map complex information and data in order to solve tasks such as intelligent recommendations and semantic search.
  • Language – Allow your apps to process natural language with pre-built scripts, evaluate sentiment and learn how to recognize what users want.
  • Speech – Convert spoken audio into text, use voice for verification, or add speaker recognition to your app.
  • Search – Add Bing Search APIs to your apps and harness the ability to comb billions of web pages, images, videos, and news with a single API call.

Which allow you to implement a wide range of functionality. Best of all, if you don’t already have an Azure account you can sign up for one for free and get more than enough free credits to build something amazing.