PHP final

Ace your homework & exams now with Quizwiz!

PHP uses which value for the first character position in a string?

0

All variables in PHP start with which symbol?

$

Which superglobal variable can be used to collect form data and is the safest option when using just PHP code?

$_POST

Which one of these variables has an illegal name?

$my-Var

Which operand will increment $x by one and then return $x?

++$x

What operator will concatenate two strings?

.

What is a correct way to add a comment in PHP?

/*...*/

Which code example is correct for assigning a text value to a variable? 1) ?php 2) echo "My dog is"$color 3) $txt = "Hello World"; 4) $x = 22

3) $txt = "Hello World";

What is the correct way to end a PHP statement?

;

PHP server scripts are surrounded by delimiters, which?

<?php ... ?>

T or F: A for loop will loop through a block of code as long as the condition is true.

False

T or F: Boolean values are used to display integer values.

False

T or F: Use the $variablename to output data to the screen.

False

Which loop will step through a block of code a specified number of times?

For

What are the 3 different variable scopes in PHP?

Global, local, and static.

What does PHP stand for today?

PHP: Hypertext Preprocessor

T or F: A PHP script can be placed anywhere in the document.

True

T or F: A do while loop will looop through a block of code once, and then repeat the loop as long as the specified condition is true.

True

T or F: In PHP you can use both single and double quotes for strings.

True

T or F: PHP can be run on Linux.

True

T or F: PHP has no command for declaring a variable. It is created the moment you first assign a value to it.

True

T or F: PHP variable names are case-sensitive

True

T or F: PHP variables must start with the $ sign

True

T or F: The PHP date() function will return the current date/time of the server

True

T or F: The echo statement can be used with or without parentheses: echo or echo()

True

T or F: When using POST method in a form, the information sent from form is invisible to others.

True

T or F: in PHP, all variable names are case-sensitive.

True

_____ are containers for storing information.

Variables

Which statement will break one iteration in a for loop?

continue;

Which loop will step through the block of code once, and then repeat the loop as long as the condition is true?

do... while

How do you write "Hello World" in PHP to display on screen?

echo "Hello World";

Which is the correct statement to generate a random number?

echo(rand));

What is the correct way to create a function in PHP?

function myFunctionName()

Which method is best to use when sending non-sensitive data by form?

get

A variable declared outside a function has a ________ and can only be accessed outside a function.

global scope

A variable declared within a function has a ________ and can only be accessed within that function.

local scope

What data type vcan have only one value and a variable of this data type has no value assigned to it?

null

How do you write "This is fun" using the print statement?

print "This is fun";


Related study sets

Holes Anatomy CH 8 muscle Assessment

View Set

Evolve Cardiovascular System, Blood, and Lymphatic Systems

View Set