Sometimes, instead of type-checking values, we can instantly cast them to types we want. We can save some lines of code by being a bit more clever.
// Instead of this $value = is_array($value) ? $value : [$value]; array_map(function ($item) { // }, $value); // You can do this array_map(function ($item) { // }, (array) $value);