6 quizzes found.

Consider the following script. What could be placed in place of ?????? to output the string:

<?php$oranges = 10;$apples = 5;$string = "I have %d apples and %d oranges";????????>
  1. str_format($string, $apples, $oranges);
  2. print($string, $apples, $oranges);
  3. printf($string, $apples, $oranges);
  4. print sprintf($apples, $oranges);
  5. sprintf($string, $oranges, $apples);

Choose 1 answers

One can ensure that headers can always be sent from a PHP script by doing what?

  1. Enable header buffering in PHP 5
  2. Set the header.force INI directive to true
  3. Enable output buffering in PHP 5
  4. There is no way to ensure that headers can always be set, they must always be checked
  5. None of the above

Choose 1 answers

The _______ constant in a CLI script is an automatically provided file resource representing standard input of the terminal.

  1. STDIN
  2. __STDIN__
  3. STDIO
  4. PHP::STDIO
  5. STD_IN

Choose 1 answers

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

<?php$file = '????????';$fr = fopen($file, 'wb9');fwrite($fr, $data);fclose($fr);?>
  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

Choose 1 answers

When writing CLI scripts it is often useful to access the standard streams available to the operating system such as standard input/output and error. How does one access these streams in PHP 5?

  1. Use stdin(), stdout() and stderr() functions
  2. PHP::STDIN, PHP::STDOUT, PHP::STDERR class constants in PHP 5
  3. STDIN, STDOUT, and STDERR constants in PHP 5
  4. use the php::stdin(), php::stdout(), and php::stderr() class methods

Choose 1 answers