Welcome to your PHP Practice Test 1. This test can be taken unlimited times. Signed in users can have their scores saved to be viewed later. Questions will be randomly displaying each test. Good luck!

1.

What will be the output of the following code?

<?php
$newarray = str_split ("Lee@greetingcards.com",3);
echo $newarray[0];
?>

2.

Namespaces were offered in PHP 6

3.

Which one of the following function finds the last occurrence of a character in a given string?

4.

Which one of the following will create an array containing 20, 15, 10, 5, 0 ?

5.

Which one of the following returns the number of characters in a string?

6.

Which one of the following returns the full path and file name of the file.

7.

PHP is a strictly typed language.

8.

Which one of the following function(s) converts data/time values into a Unix timestamp.

9.

Which one of the following is correct for E_ERROR?

10.

Which of the following is/are the correct form(s) of a conditional statement in PHP?

11.

In PHP, each statement needs to be end with dot.

12.

Methods are also known as instances.

13. What is the output of the following code?

<?php
$x = 7;
$y = 7.0;
var_dump($x===$y);
?>

14.

Which one of the following converts an entire string to uppercase?

15.

What will be the output of the echo number_format(3957459.7398);

16.

Which of the following will display the timestamp of the current system date and time?

17.

What is the output of the following PHP code?

<?php
//Let's find the number of o's in our string.
$count = substr_count ("Hello World!","l");
echo "There are " . $count . " instance (s) of \"l\" in Hello World!.";
?>

18.

Which of the following function(s) will check if the file exists or not?

19.

Which of the following will turn off all error reporting in PHP?

20.

What is the output of the following code?

<?php
$text = "Hello, how are you today? I am fine!";
if (strlen ($text) >= 30){
echo substr ($text,0,27);
} else {
echo $text;
}
?>

21.

 What is the output of the following?

function fun( &$arg ) {
$return = $arg; $arg += 1; return $return; }
$x = 3;
$y = fun( $x );
echo "x is ". $x . " and y is ". $y;
?>

22.

Which function will return the total number of an array called $arr?

23.

In PHP you can’t redefine the following variables.

24.

PHP variables are case sensitive.

25.

What is the output of the following code?

$num = 5;
echo 'He can speak $num++ different languages';
?>



Last modified: December 17, 2019

Comments

Write a Reply or Comment

Your email address will not be published.