I have the following code:
$path = ltrim($_SERVER['REQUEST_URI'], '/');
$elements = explode('/', $path);
var_dump($elements);
echo is_array($elements) ? 'true' : 'false';
$elements=array_shift($elements);
explode(delimeter, string) should return array. And it is returning as is_array(bool) returns true, but array_shift(array) gives following error:
Warning
: array_shift() expects parameter 1 to be array, string given in
Why is this happening even when $elements is an array?
PHP 7.2.19