public static function toStackTrace($ex)
    {
        $list = [];
        for ($stack = Throwable::getThrowableStack($ex); $stack !== null; $stack = $stack['prev'])
        {
            $list = array_merge($stack['trace'], $list);
        }

        return $list;
    }
public static function toStackTrace($ex)
    {
        $list = [];
        for ($stack = Throwable::getThrowableStack($ex); $stack !== null; $stack = $stack['prev'])
        {
            $list = array_merge($stack['trace'], $list);
        }

        return $list;
    }
public static function toStackTrace ( $ ex ) { $ list = [ ] ; for ( $ stack = Throwable :: getThrowableStack ( $ ex ) ; $ stack !== null ; $ stack = $ stack [ 'prev' ] ) { $ list = array_merge ( $ stack [ 'trace' ] , $ list ) ; } return $ list ; }
Return Exception stack trace in array format.

@param \Error|\Exception $ex
@return string[]
Return Exception stack trace in array format .