PHP Basic Programs for Beginners
PHP Basic Programs for Beginners - Important Points
21. | Which of the following is the correct way to check if a string contains a specific substring in PHP? |
---|
A. if (strpos($myString, "world") !== false) { ... }
B. if (substr($myString, "world") !== false) { ... }
C. if ($myString contains "world") { ... }
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
22. | What is the output of the following PHP code snippet? <?php |
---|
A. 3
B. red, green, blue
C. Array
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
23. | Which of the following is the correct way to declare a constant in PHP? |
---|
A. define("PI", 3.14);
B. const PI = 3.14;
C. PI = 3.14;
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
24. | What is the output of the following PHP code snippet? <?php |
---|
A. The variable is true
B. The variable is false
C. 1
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
25. | Which of the following is the correct way to create a multidimensional array in PHP? |
---|
A. $myArray = array("red", array("green", "blue"), "yellow");
B. $myArray = array("red", "green", "blue", "yellow");
C. $myArray = array(array("red", "green"), array("blue", "yellow"));
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation: