NEW
Font size
WorksheetsStrings and Arrays
Total questions: 13
Worksheet time: 13mins
In PHP the _______ function returns the total number of characters in a string.
len()
str_length()
length()
strlen()
In PHP the __________ function is used to find out whether some text occurs within a string.
strstr()
find()
count()
str_find()
In PHP the __________ function finds the last match in the string, rather than the first
strpos()
str_last()
strrpos()
strpos_last()
Which of the following is not a Built-in String functions in php?
strlen()
str_replace()
strpos()
strreverse()
Which of the following is the output of the below code?
<?php echo strpos("Hello letsfindcourse!", "lets"), " \n"; ?>
4
5
6
7
Predict the output of the following code snippet :
<?php $str="chess was played"; echo strlen(substr($str,3,2))." " ?>
1
2
null
3
Arrays with named keys in PHP are called ________
Associative arrays
Indexed arrays
Multidimensional arrays
named arrays
The _____ function is used to sort associative arrays in descending order, according to the key in PHP.
arsort()
krsort()
ksort()
sort()
The _____ function removes the first element from the start of an array in PHP.
array_shift()
array_pop()
array_push()
array_unshift()
In PHP the _____ function adds one or more new elements to the end of an array.
array_unshift()
array_push()
array_shift()
array_pop()
Which of the following are correct ways of creating an array? i) state[0] = "karnataka"; ii) $state[] = array("karnataka"); iii) $state[0] = "karnataka"; iv) $state = array("karnataka");
iii) and iv)
ii) and iii)
Only i)
ii), iii) and iv)
Key/value pair can be initialized using => operator?
True
False
Depend on program
Keys does not exist in array
In PHP the __________ function is used to find out whether some text occurs within a string.
strstr()
find()
count()
str_find()
