Server-side Web Development (I3302) 2017-2018 PHP Language Quiz
19 Questions
2 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

In PHP, which function is used to display text?

  • display_text()
  • print_r()
  • printf()
  • echo() (correct)

What is the purpose of the 'date()' function in PHP?

  • To display the date of the last server restart
  • To retrieve the current server date
  • To format and display the current server date and time (correct)
  • To create a new date variable

Which method is used to pass variables in PHP through the URL?

  • PUT method
  • DATA method
  • GET method (correct)
  • POST method

What does the 'include' statement do in PHP?

<p>It includes another PHP file in the current PHP script (A)</p> Signup and view all the answers

In PHP, what does the 'define()' function do?

<p>It declares a constant (D)</p> Signup and view all the answers

Which type of array in PHP uses named keys that you assign to them?

<p>Associative array (C)</p> Signup and view all the answers

What is the purpose of the 'exit()' function in PHP?

<p>To terminate the script and return a value to the calling code (D)</p> Signup and view all the answers

How can environment variables be accessed in PHP?

<p>$_SERVER['variable_name'] (D)</p> Signup and view all the answers

Which of these is used to stop the execution of a script in PHP?

<p>'exit' (B)</p> Signup and view all the answers

What tags are used to display bold text in PHP?

<p>(C)</p> Signup and view all the answers

In PHP, how can you convert a variable into a primitive type by casting?

<p>(int)$var (D)</p> Signup and view all the answers

Which function in PHP returns true if the variable is empty?

<p>empty($var) (B)</p> Signup and view all the answers

What is the syntax for assigning a variable identifier the value of another variable in PHP?

<p>${$var} = value; (B)</p> Signup and view all the answers

In PHP, what is the purpose of the isset($var) function?

<p>Returns true if the variable exists (D)</p> Signup and view all the answers

What does the following syntax do in PHP: $name_variable = 3;

<p>Assigns the value 3 to the variable $name_variable (A)</p> Signup and view all the answers

In PHP, what is the purpose of the unset($var) function?

<p>Destroys a variable (B)</p> Signup and view all the answers

In PHP, what does $nbr = (int)$str; do?

<p>$nbr equals to $str as an integer (D)</p> Signup and view all the answers

What are the three sorts of 'data' that can be stored in a variable in PHP?

<p>text, numbers, or boolean (D)</p> Signup and view all the answers

$str = '12'; $nbr = (int)$str; // What does $nbr equal to after this in PHP?

Signup and view all the answers

Flashcards

PHP echo() function

Displays text output in PHP.

PHP date() function

Formats and displays the current server date and time.

PHP GET method

Passes variables through the URL.

PHP include statement

Includes another PHP file in the script.

Signup and view all the flashcards

PHP define() function

Declares a constant.

Signup and view all the flashcards

Associative array

PHP array with named keys.

Signup and view all the flashcards

PHP exit() function

Terminates the script.

Signup and view all the flashcards

PHP environment variables

Accessed via $_SERVER['variable_name'].

Signup and view all the flashcards

PHP exit keyword

Stops code execution.

Signup and view all the flashcards

PHP bold text tags

Not specified in provided content.

Signup and view all the flashcards

PHP variable casting (int)

Converts a variable to an integer.

Signup and view all the flashcards

PHP empty() function

Checks if a variable is empty.

Signup and view all the flashcards

PHP variable assignment with $this

Assigns a value to a variable using variable variables.

Signup and view all the flashcards

PHP isset() function

Checks if a variable is set and not null.

Signup and view all the flashcards

PHP variable assignment

Assigns value 3 to variable $name_variable.

Signup and view all the flashcards

PHP unset() function

Removes a variable from memory.

Signup and view all the flashcards

Study Notes

PHP Functions and Syntax

  • The echo function is used to display text in PHP.

Date and Time

  • The date() function returns the current date and time.

Passing Variables

  • Variables can be passed through the URL using the GET method.

Including Files

  • The include statement is used to insert the contents of one PHP file into another.

Defining Constants

  • The define() function is used to define a constant.

Array Types

  • An associative array is a type of array that uses named keys that are assigned to them.

Script Execution

  • The exit() function is used to stop the execution of a script.

Environment Variables

  • Environment variables can be accessed in PHP using the $_SERVER or $_ENV superglobals.

Stopping Script Execution

  • The die() or exit() function is used to stop the execution of a script.

Displaying Bold Text

  • The <b> tag is used to display bold text in PHP.

Casting Variables

  • A variable can be converted to a primitive type by casting using the (type) syntax.

Checking Variable Emptiness

  • The empty() function returns true if the variable is empty.

Variable Assignment

  • The syntax for assigning a variable identifier the value of another variable is $var2 = $var1.

Variable Existence

  • The isset() function checks if a variable is set and is not null.

Variable Unsetting

  • The unset() function is used to unset a variable.
  • The unset() function sets a variable to null.

Type Casting

  • $nbr = (int)$str; casts the string $str to an integer and assigns it to $nbr.

Data Types

  • Three types of data that can be stored in a variable in PHP are strings, integers, and floats.
  • After $str = '12'; $nbr = (int)$str;, $nbr equals 12.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge of PHP language and server-side web development concepts such as displaying text, using comments, functions like date(), passing variables with get and post, including external files, working with variables and constants, control instructions, dynamic functions, environment variables, arrays, and associative arrays.

More Like This

Use Quizgecko on...
Browser
Browser