Article of the week

Longest Collatz sequence in PHP

Longest Collatz sequence in PHP

08 Feb 2020 23:30:22


The longest Collatz sequence for input less than N in PHP programming language.


Read full article »

Recent articles

Comparing two arrays or objects with a function in PHP

17 Aug 2017 16:07:40

Comparing two arrays or objects with a function in PHP

In this article I look how to compare two ordinary arrays (or objects based on array). The problem can be solved fairly easily using a comparison function. It accepts two items, one from each of two arrays you need to compare and returns a result of the comparison. You gather ...

Read more »

Formatting array of numbers recursively in PHP

12 Aug 2017 15:57:38

Formatting array of numbers recursively in PHP

If you have ever tried to obtain a formatted value in PHP, it is likely you did so with one of printf, sprintf of vsprintf functions. In general, these utilities accept a formatting string and one or more arguments. php.net has some good examples and descriptions on how they ...

Read more »

Recursive min and max functions in PHP and speed test

05 Aug 2017 15:03:39

Recursive min and max functions in PHP and speed test

This article provides two more examples of PHP functions which employ linear recursion. They are min() and max(). I wrote them partly for fun, but also to carry out a basic speed test on a piece of interpreted PHP code, results of which I hoped, would give me some insight into ...

Read more »

Recursive implementations of some Maths sequences and series in PHP

28 Jul 2017 17:54:44

Recursive implementations of some Maths sequences and series in PHP

In this article I give a couple of PHP implementations of popular Maths sequences and series. Broadly, each piece of code given returns nth term of a sequence / series. Each of the implementations depends on linear recursion. Each of the functions a is a static methods of class ...

Read more »