20 quizzes found.

For an arbitrary string $mystring, which of the following checks will correctly determine if the string PHP exists within it?

  1. if(strpos($mystring, "PHP") !== false)
  2. if(!strpos($mystring,"PHP"))
  3. if(strpos($mystring, "PHP") === true)
  4. if(strloc($mystring, "PHP") == true)
  5. if(strloc($mystring, "PHP") === false)

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

If you wanted a variable containing the letters A through Z, that allowed you to access each letter independently, which of the following approaches could you use?

  1. $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  2. range('A', 'Z');
  3. explode("", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  4. You would use the ALPHA_ARRAY constant
  5. None of the above

Choose 3 answers

Which of the following are not valid ways to embed a variable into a string?

  1. $a = "Value: $value->getValue()";
  2. $a = "Value: {$value}";
  3. $a = 'Value: $value';
  4. $a = "Value: $value";
  5. $a = "Value: {$value['val']}";

Choose 2 answers

Given the two values below, which of the following possiblities will print 10 foos20 bars?

<?php

$var1 = "10 foos";
$var2 = "20 bars";

print ???????;

?>
  1. None of the above
  2. implode("", array($var1,$var2));
  3. $var1 . $var2
  4. $var1 + $var2
  5. All of the above

Choose 2 answers