Register|Login

Have a question? Click here to ask the community.

Quiz 9 – Require

| In: PHP Quizzes | 13,467 views

*You are currently not logged in and your quiz score will not be recorded. Please login or register if you would like to submit your quiz score.

Directions: Answer all questions. Any questions skipped will be scored as wrong answers. Good Luck! :)

1. When you include a file with the require command and PHP cannot find that file, you will receive an error message?

True
False

2. The require command takes a file name and simply inserts that file’s contents into the script/document that issued the require command?

True
False

3. Which of the following is the correct way to use the require command?

require(“example.php”)
require “example.php”;
require(“example.php”);
None of the above

4. Based on the following two files, index.php and content.php, what will be displayed in your browser when visiting index.php?

File content.php contains:
<?php
echo “Hello World”;
?>

File index.php contains:
<html>
<body>
<?php
require(“content.php”);
?>
<br>Hello Earth
</body>
</html>

Hello World
Hello Earth

Hello Earth
Hello World

Hello World
Hello Earth

5. Based on the following two files, index.php and content.php, what will be displayed in your browser when visiting index.php?

File content.php contains:
<?php
echo “Hello World”;
?>

File index.php contains:
<html>
<body>
<br>Hello Earth
<?php
require(“content.php”);
?>
</body>
</html>

Hello World
Hello Earth

Hello Earth
Hello World

Hello World
Hello Earth

Comment Form

You must be logged in to post a comment.

Users Online

Users Online: 4 Users

Most Users Ever Online: 91

Quiz Scores

Advertisments