PHP Strings Quiz Questions and Answers
1. What is the output of the following code snippet?
$str = 'asdfghyo off on off';
$replace_pairs = array('a' => 'q', 's' => 'w', 'd' => 'e', 'f' => 'r', 'y' => 'z', 'o' => 'i', 'off' => 'on', 'on' => 'off');
echo strtr($str, $replace_pairs);
Loading...
2. What is the output of the following code snippet?
echo stristr('PHPzphpZPHPZfoo', 'Z');
echo stristr('PHPzphpZPHPZfoo', 'Z');
Loading...
3. What is the output of the following script?
echo strlen('foo' . chr(0) . '1'), ', ', strlen(0x00);
echo strlen('foo' . chr(0) . '1'), ', ', strlen(0x00);
Loading...
4. What is the function of the ucfirst and lcfirst functions?
Loading...
5. What is the output of the following?
echo strcmp('first', 'second'), ", ";
echo strcmp('44', '054'), ", ";
echo strcmp('0x80', 'a'), ", ";
echo strcmp('a', 'A');
echo strcmp('first', 'second'), ", ";
echo strcmp('44', '054'), ", ";
echo strcmp('0x80', 'a'), ", ";
echo strcmp('a', 'A');
Loading...
Are these questions helpful for you?
Comments: (Your feedback is valuable to us)