<?php
    $zip = new zipArchive();
    $file = "/path/file.zip";
    
    if ($zip ->open($file, zipArchive::CREATE) !== TRUE)
    {
        exit("Can't open <$file");
    }
    
    $zip ->addFromString("example.txt" . time(), // string added as 'example.txt');
    $zip ->addFromString("example2.txt" . time(), // string added as 'example2.txt');
    $zip ->addFile("/path/file2.php", "/test_file.php");
    
    echo "numfile" . $zip ->numfiles . "<br />";
    echo "status" . $zip ->status . "<br />";
    $zip ->close();
?>