What You Should Know About PHP 7

0
695

The latest edition of PHP, the programming language in which the Moodle core is written, is a promising revamp of the otherwise primeval tool. PHP 7 has shown to be significantly faster and more versatile than previous releases.

Previously in MoodleNews: Long Live PHP. Moodle Jobs And Technology Trends Update

Still, at every new revision of a solution on which we come to rely, the many misplaced or reshaped functionality can be the bane of the dev’s existence. In order to spare you at least part of it, we’ve made this quick guide to composure-rewarding PHP 7.

What is PHP?

PHP: Hypertext Preprocessor is a programming language designed for software that requires the user to make requests involving tools and data from a server over the internet, and the server to produce customized responses. Like all programming languages, it has ideal case scenarios but is a general-purpose language that today supports most programming paradigms. And, of course, it is open source.

What made it the best choice for the Moodle core?

Whether it was the best choice is debatable. The most likely answer is simply that it was what everyone else was using when the founder of Moodle was at Uni at the time of his doctorate. We can see that the evolution of Moodle has included a growing deal of JavaScript, the most widely used language for web development today. Still, to PHP credit is its feasibly steady learning curve, its comparative tolerance for small errors (admittedly, a double-edged sword) and the wide availability of case-specific “accelerators.”

See also: Mesmerizing Video Narrates 15 Years Of Moodle Evolution Through Its Source Code

How do I get started with it?

The easiest way to make use of PHP, especially if you want to use it for Moodle, is to download the LAMP (in Linux) or WAMP (in Windows) bundle, which ships Apache (server), MySQL (database) and PHP languages. This assortment gives a full toolset for Moodle development, as well as many popular, Open Source systems today, including WordPress.

Regarding learning PHP, it is fairly easy to hit the ground running and there are lots of tutorials, interactive tools or course-long videos. Since it allows for many programming paradigms, perhaps the easiest to understand in an actionable way is “Object Oriented Programming”: Objects are individual entities made out of attributes (variables) which may or may not change, and things they are capable of (methods or functions) including changing attributes of themselves or other objects. Just like you and me! Objects can contain other objects, and can create, be created, destroy and be destroyed by other objects.

What can I do with it?

Moodle plugins! PHP 7 is the language required for Moodle 3.5 and soon will become the de facto language for Moodle. PHP is necessary to interact with the functions available in each Activity. To access data, PHP code must open a line of communication with the database using the Activity’s API (Application Programming Interface).■


Moonami LogoThis Moodle Technology related post is made possible by: Moonami a company that provides a full range of Moodle services that combine the flexibility, scalability, and power of Amazon’s world-leading cloud platform (AWS) with fanatical Moodle support. Click here to learn more.