If on PHP 8.0+, you can use match expression to decode status code:
<?php
$archive = new \ZipArchive();
$result = $archive->open('some.file.zip');
$message = match ($result) {
\ZipArchive::ER_MULTIDISK => 'Multi-disk zip archives not supported',
\ZipArchive::ER_RENAME => 'Renaming temporary file failed',
\ZipArchive::ER_CLOSE => 'Closing zip archive failed',
\ZipArchive::ER_SEEK => 'Seek error',
\ZipArchive::ER_READ => 'Read error',
\ZipArchive::ER_WRITE => 'Write error',
\ZipArchive::ER_CRC => 'CRC error',
\ZipArchive::ER_ZIPCLOSED => 'Containing zip archive was closed',
\ZipArchive::ER_NOENT => 'No such file',
\ZipArchive::ER_EXISTS => 'File already exists',
\ZipArchive::ER_OPEN => 'Can\'t open file',
\ZipArchive::ER_TMPOPEN => 'Failure to create temporary file',
\ZipArchive::ER_ZLIB => 'Zlib error',
\ZipArchive::ER_MEMORY => 'Malloc failure',
\ZipArchive::ER_CHANGED => 'Entry has been changed',
\ZipArchive::ER_COMPNOTSUPP => 'Compression method not supported',
\ZipArchive::ER_EOF => 'Premature EOF',
\ZipArchive::ER_INVAL => 'Invalid argument',
\ZipArchive::ER_NOZIP => 'Not a zip archive',
\ZipArchive::ER_INTERNAL => 'Internal error',
\ZipArchive::ER_INCONS => 'Zip archive inconsistent',
\ZipArchive::ER_REMOVE => 'Can\'t remove file',
\ZipArchive::ER_DELETED => 'Entry has been deleted',
default => 'No error',
};
?>