@philsturgeon and @FrenkyNet I just used the ```array_filter``` solution. Could it be problematic since it removes all falsy values and not just nulls? If we wanted strictly to remove only nulls, we could do:

```php
$p = array_map(function($element) {
    if ($element !== null) {
        return $element;
    }
}, $path_elements);
```