5 pages tagged with "php"
Phel: the Lisp that compiles to PHP
February 01, 2021The new Functional Programming language build-in PHP. Check it out!
The new Functional Programming language build-in PHP. Check it out! The Phel Language Phel is a Functional Programming (FP) language that compiles to PHP. It is a dialect of Lisp inspired by Clojure and Janet. Features Built on PHP’s ecosystem Good error reporting Different Datastructures (Arrays,…Never use array_merge in a loop
November 10, 2020Using array_merge inside a loop is a performance killer. The spread operator will help you to improve this by flatting the array.
Using array_merge inside a loop is a performance killer. The spread operator will help you to improve this by flatting the array. Flattening a one-level array I have seen people using the array_merge function in a loop like: <?php $lists = [ [1, 2], [3, 4], [5, 6], ]; $merged = []; foreach…Typed arrays in PHP
October 13, 2020Argument unpacking, function variable argument list, and variadics function.
Argument unpacking, function variable argument list, and variadics function. The perfect combination Argument unpacking: Instead of passing the argument itself to the function, the elements it contains will be passed (as individual arguments). Function variable argument list: The arguments will be…Strict Types in PHP
August 09, 2020In December 2015, PHP 7 introduced scalar type declarations and with it the strict types flag. What is this new feature?
In December 2015, PHP 7 introduced scalar type declarations and with it the strict types flag. What is this new feature? The good thing about declaring a PHP file as strict is that it actually applies to ONLY the current file. It ensures that this file has strict types, but it doesn’t apply to any…Final classes in PHP | Java | Any
June 06, 2020Clear contracts, isolated side effects, testability, low complexity and cognitive load, code fluidity, and confidence in yourself.
Clear contracts, isolated side effects, testability, low complexity and cognitive load, code fluidity, and confidence in yourself. Motivation Reduce the scope visibility to the minimum When you see a class prefix with final you will prevent a particular class to be extended by any other, which not …