Recursively check if value exits in array

The native in_array php function is very handy to check if a value exists in an array. But when you are working with multidimensional arrays it does not work anymore.

When you want to check if your value exists in the multidimensional array, you can use the following helper function to acomplish that.


 * Enhancement for the native php function in_array.
 * It can now recursively check if a value exists
 * in a given array.
 * @param $needle
 * @param $haystack
 * @param bool $strict
 * @return bool
function in_array_r($needle, $haystack, $strict = false)
    foreach ($haystack as $item) {
        if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
            return true;

    return false;



Clean code

Joeri Timmermans, a Symfony developer at Intracto, created a blog post to share some of his personal experiences and tips to write clean code.

Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. 

He gives tips about writing cleaner code but also explains why it is so important to write clean code.

You can read the full article on the Intracto blog

Passing variables by Value vs. by Reference Visual Explanation

Penjee released a in depth tutorial that explains the difference between passing by value and by reference.

When writing software code, you will spend a lot of time defining, reading and changing variables. Using a variable means you use a descriptive word in your code which holds some information (a number, some text, an object, etc.). This descriptive word is the “title” of the stored information

Hello world!

Welcome to my brand new blog. It is a personal experiment to improve my writing and a backlog for problems I tackled in the past. And maybe I can help someone else with any of the solved problems.

Find any typos? Please let me know I do my best not making them but as a dyslectic it is sometimes really hard so I would appreciate it to drop me a line if you find a typo.