error_get_last

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8
Get the last occurred error
<?php error_get_last(): ?array
<?php         $stmt = @db2_prepare($this->conn, $sql);



        if ($stmt === false) {

            throw PrepareFailed::new(error_get_last());

        }



        return new Statement($stmt);
<?php         $handle = @tmpfile();



        if ($handle === false) {

            throw CannotCreateTemporaryFile::new(error_get_last());

        }



        return $handle;
<?php     private function copyStreamToStream($source, $target): void

    {

        if (@stream_copy_to_stream($source, $target) === false) {

            throw CannotCopyStreamToStream::new(error_get_last());

        }

    }
<?php     private function writeStringToStream(string $string, $target): void

    {

        if (@fwrite($target, $string) === false) {

            throw CannotWriteToTemporaryFile::new(error_get_last());

        }

    }

}