array_unshift

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Prepend one or more elements to the beginning of an array
<?php array_unshift(array &$array, mixed ...$values): int
<?php         $trace = $exception->getPrevious()->getTrace();



        array_unshift($trace, [

            'file' => $e->getFile(),

            'line' => $e->getLine(),

        ]);



        $traceProperty = new ReflectionProperty('Exception', 'trace');

        $traceProperty->setAccessible(true);
<?php         $exception = new StatamicParseException(...$args);



        $trace = $exception->getTrace();

        array_unshift($trace, [

            'file' => $e->getFile(),

            'line' => $e->getLine(),

            'class' => StatamicParseException::class,

            'args' => $args,

        ]);

        $traceProperty = new ReflectionProperty('Exception', 'trace');

        $traceProperty->setAccessible(true);

        $traceProperty->setValue($exception, $trace);