Question About creating a Zlib-compressed file - From Mock Cert Exam

I just took a mock Zend PHP 5 certification exam which had the following question…

What should go in the ??? assignment below to create a Zlib-compressed file foo.gz with a compression level of 9?


$file = '???????';

$fr = fopen($file, 'wb9');
fwrite($fr, $data);
fclose($fr);


I don’t know a ton about creating compressed files, but I was under the impression you were supposed to use gzopen, and that the number 9 in ‘wb9’ above wasn’t valid with fopen.

Anyway, the multiple choice answers given are…

  1. gzip://foo.gz?level=9
  2. compress.zip://foo.gz?level=9
  3. compress.zlib://foo.gz
  4. compress.gzip://foo.gz?level=9
  5. zlib://foo.gz

Anyone know the answer?

On a side note, I know people have mixed feelings on this exam, but I figure it’s pretty cheap and supposedly not too difficult so what the hell. I actually passed the practice exam with “Excellent”. But I have a couple weak areas (streams, network programming, and RegEx) Has anyone taking the practice exams and real exam? If so, how would you say they compare?

http://www.php.net/manual/en/wrappers.compression.php

so, compress.zlib://foo.gz

Thanks for the reply. Too bad I can’t use the manual on the exam. Who memorizes stuff like that?

Ya, that’s a pretty obscure question. I would have had to guess.

I remember that one, yup, I guessed.

I managed to guess it by reduction.

The answers with level9 aeren’t appropriate, due to it being already specified in fopen.

That leaves 2 answers, from which is an obvious answer.