nerdexam
Zend

200-710 · Question #199

You want to access the 3rd character of a string, contained in the variable $test. Which of the following possibilities work? (Choose 2)

The correct answer is B. echo $test[2]; D. echo $test(2). See the full explanation below for the reasoning.

Strings & Patterns

Question

You want to access the 3rd character of a string, contained in the variable $test. Which of the following possibilities work? (Choose 2)

Options

  • Aecho $test{3};
  • Becho $test[2];
  • Cecho $test{2};
  • Decho $test(2);
  • Eecho $test[3];

How the community answered

(54 responses)
  • A
    4% (2)
  • B
    76% (41)
  • C
    11% (6)
  • E
    9% (5)

Topics

#string character access#curly brace syntax#square bracket indexing

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice