Technology ·

PHP

PHP. It's not a good programming language. It's not a bad programming language either. Calling it bad will be a disrespect to other bad languages like VB, R and Prolog. It's a shame; a pathetic excuse for people who wanted a language that one can program in without a single working molecule in their brains.

First, it isn't even a programming language; it's a scripting language suffering from severe imposter syndrome. It is case sensitive as well as insensitive, depending on the situation. It uses references, especially where it kills the purpose, e.g. you can write: $myinstance=&get_instance();

Its most famous framework - Codeigniter! Well, when a bunch of clowns get together, you have a circus right?! Yup! If you're writing a custom helper class, your filename must end with "_helper". If you are writing a custom library though, your filename must start with "MY_". Underscores have their own sentiments, so it's better to write names like convertjsonarraytoarray instead of convert_json_array_to_array. A constructor needs two underscores __construct() even when there's a keyword "construct" reserved.

And did I just say array? Well, they are also from a different school of thought (read planet). You don't do: $myarray = ['alpha', 'beta', 'gamma']; No sir! That syntax is reserved to create JSON-like objects. Arrays want you to say: $myarray = array('alpha', 'beta', 'gamma');

String concatenations use a dot "first" . "second" while referring to a method uses syntax $class->function();

Design patterns were forced like siblings from your step-mom. In an MVC pattern, you can write entire data logic, business logic and client logic in model and pass it to controller which would pass it to view. You can also go other way round if you want. Nothing can stop you.

If you're learning PHP like me in 2022, WHAT THE HECK IS WRONG WITH YOU?