- var_dump: documentation ( source)
- stream_get_contents: documentation ( source)
<?php
$zip = new ZipArchive;
$res = $zip->open('examle.zip', ZipArchive::CREATE);
$zip->addFromString('example.txt', 'example text file');
$fp = $zip->getStream('example');
var_dump(stream_get_contents($fp));