Answer & Solution
strlen() function in PHP is used to return the length of a string. Therefore, strlen('Hello') will return 5, as the string 'Hello' contains five characters.
| PHP | MYTAT"> | PHP | MYTAT">
strlen('Hello')
strlen() function in PHP is used to return the length of a string. Therefore, strlen('Hello') will return 5, as the string 'Hello' contains five characters.
Which of the following PHP operators is used to compare whether two values are equal and of the same data type?
A). ===
B). ==
C). =
D). !=
What will be the output of the following PHP code?<?php
$x = 5;
echo $x--;
echo $x;
?>
A). 5 4
B). 5 5
C). 4 4
D). 4 5
Which of the following is a correct way to assign a floating-point number to a variable in PHP?
A). $price = 10.99;
B). $price = '10.99';
C). $price = '10.99';
D). $price = 10;
What data type is the variable $age = 25; in PHP?
A). Integer
B). String
C). Boolean
D). Float
What is the correct way to declare a variable in PHP?
A). $name = 'John';
B). name = 'John';
C). var name = 'John';
D). String name = 'John';
What is the value of $x after the following PHP code is executed?<?php
$x = 5;
$x += 3;
echo $x;
?>
A). 5
B). 8
C). 15
D). 3
What will be the result of the expression 'Hello' . ' World' in PHP?
A). 'Hello World'
B). 'Hello . World'
C). 'Hello + World'
D). 'Hello, World'
Which of the following is a valid variable name in PHP?
A). $my_var
B). $my-var
C). $my var
D). my_var
Which of the following PHP operators is used for concatenation of strings?
A). .
B). +
C). &&
D). *
Which of the following is a correct way to declare an array in PHP?
A). $colors = array('Red', 'Green', 'Blue');
B). $colors = 'Red, Green, Blue';
C). $colors = {'Red', 'Green', 'Blue'};
D). $colors = [Red, Green, Blue];