14 quizzes found.

What is the best way to ensure that a user-defined function is always passed an object as its single parameter?

  1. function myfunction(stdClass $a)
  2. function myfunciton($a = stdClass)
  3. Use is_object() within the function
  4. There is no way to ensure the parameter will be an object
  5. function myfunction(Object $a)

Choose 1 answers

Which two internal PHP interfaces provide functionality which allow you to treat an object like an array?

  1. iteration
  2. arrayaccess
  3. objectarray
  4. iterator
  5. array

Choose 2 answers

Which of the following functions will sort an array in ascending order by value, while preserving key associations?

  1. asort()
  2. usort()
  3. krsort()
  4. ksort()
  5. sort()

Choose 1 answers

What is the output of the following code block?

<?php

$a = "The quick brown fox jumped over the lazy dog.";

$b = array_map("strtoupper", explode(" ", $a));

foreach($b as $value) {
	print "$value ";
}

?>
  1. THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.
  2. A PHP Error
  3. Array Array Array Array Array Array Array Array Array

Choose 1 answers

Which of the following functions could be used to break a string into an array?

  1. array_split()
  2. split()
  3. string_split()
  4. preg_match_all()
  5. explode()

Choose 3 answers