PHP

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

how is a comment block made?

/* */

in php how must a variable name start?

A variable name must start with a letter or an underscore _

is PHP server side or client side scripting language?

server side

Where does the real power in PHP come from?

From over 700 functions

how are php files returned to the browser?

PHP files are returned to the browser as plain HTML

how is a single line comment made in php?

With //

What is meant by the term strongly typed?

variables have to be defined before they can be used

What are the looping statements in PHP?

while, do while , for and foreach

how must each php code line end?

with a semi colon

if a variable name is more than one word how should it be formatted?

with an underscore between words or with the second word capitalized

how do all funtions in PHP start?

with the word function

The correct way of setting a variable in PHP:

$var_name = value;

if more than one line is to be executed as a result of the if else statement then the lines to be executed should be enclosed in curly braces

...

how is a php started and ended?

A PHP scripting block always starts with <?php and ends with ?>

What is a function?

A function is a block of code that can be executed whenever we need it.

what is a numeric array?

A numeric array stores each element with a numeric ID key.

what are parameters?

A parameter is just like a variable.

What is a string variable used for?

A string variable is used to store and manipulate a piece of text.

What kinds of characters can a variable name contain?

A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ )

what do all variables start with?

All variables in PHP start with a $ sign symbol.

What is an Array?

An array can store one or more values in a single variable name.

Why is the include() and require() function useful?

Because it can save a considerable amount of time by allowing you to change only a couple of files when headers,footers or menus have to be changed for a website instead of having to maually change all the pages.

how are elements in an array accessed?

Each element in the array has its own ID so that it can be easily accessed.

What methods can the $_request variable be used with?

GET and POST

What are associative arrays?

In An associative array, each ID key is associated with a value.

What is a multidimensional array?

In a multidimensional array, each element in the main array can also be an array. And each element in the sub-array can be an array, and so on.

What are the advanteages to using $_POST

Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

What is the advantage of arrays?

Instead of having many similar variables, you can store the data as elements in an array.

What is the primary advantage of using the switch statement?

It avoids avoid long blocks of if..elseif..else code.

What are looping statements used for?

Looping statements in PHP are used to execute the same block of code a specified number of times.

What are two different ways numeric array id's can be created?

Manually or automatically

There are three different kinds of arrays?

Numeric, associative, and multidimensional

what are operators used for?

Operators are used to operate on values.

What does php stand for?

PHP stands for PHP: Hypertext Preprocessor

What are server side includes?

Server Side Includes (SSI) are used to create functions, headers, footers, or elements that will be reused on multiple pages.

What is the the $_GET Variable

The $_GET variable is an array of variable names and values sent by the HTTP GET method. The $_GET variable is used to collect values from a form with method= get

What is the the $_post Variable?

The $_POST variable is an array of variable names and values sent by the HTTP POST method. The $_POST variable is used to collect values from a form with method= post .

what are the $_get and $_post variables used for?

The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.

what is the purpose of the $_REQUEST Variable?

The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE.

What is the PHP date() function used for?

The PHP date() function is used to format a time or a date.

What is the only string operator in php?

The concatenation operator (.)

How does the include() or require() function handle errors?

The include() function generates a warning (but the script will continue execution) while the require() function generates a fatal error (and the script execution will stop after the error).

How are the include() or require() function different?

The two functions are identical in every way, except how they handle errors

What are variables used for?

Variables are used for storing values, such as numbers, strings or function results, so that they can be used many times in a script.

What is the most important thing to notice when dealing with HTML forms and PHP?

any form element in an HTML page will automatically be available to your PHP scripts.

where can a php script be placed in the document?

anywhere

What kinds of different operators exist?

arithmetic, assignment, comparison, and logical

where is the functions code located?

between the curly braces

how do you add more functionality to functions?

by adding parameters

what are two basic statements to output text with PHP?

echo and print

when should the if else statement be used?

if you want to execute a set of code when a condition is true and another if the condition is not true

What do the include() or require() function allow you to do?

insert the content of a file into a PHP file before the server executes it

when should the else if statement be used?

is used with the if...else statement to execute a set of code if one of several condition are true

what is the purpose of the semi colon?

it is a separator and used to distinguish one set of instructions from another

What does the for statement do?

loops through a block of code a specified number of times

What does the foreach statement do?

loops through a block of code for each element in an array

What does the while statement do?

loops through a block of code if and as long as a specified condition is true

What does the do..while statement do?

loops through a block of code once, and then repeats the loop as long as a special condition is true

is PHP strongly or loosely typed?

loosely

What is the purpose of the Expat parser?

makes it possible to process XML documents in PHP

should a variable name contain spaces?

no

in php does a variable need to be declared (created) before being set?

no, php automatically creates the variable and sets it to the correct type.

What is another disadvantage of using the $_get variable?

since the information is transmitted and visible in the address bar is is not secure for personal data

how should a function be named?

so that you can understand what it does by it's name

If you want to select one of many blocks of code to be executed which statement should be used?

switch

What is the disadvantage of using the $_get variable?

the largest variable it can hold is 100 characters

What is the advantage of using the $_get variable?

the page can be bookmarked

what happens if the php file has an html extension instead of PHP?

the php code will not be executed

What is the advantage of validating a form on the server by posting to itself?

the user will then get the error messages on the same page as the form. This makes it easier to discover the error.

What is the switch statement used for in PHP?

to perform one of several different actions based on one of several different conditions.

A good way to validate a form on the server

to post the form to itself, instead of jumping to a different page.

What is the concatenation operator used for?

to put two string values together.

What is another way functions can be used?

to return values


Kaugnay na mga set ng pag-aaral

Identify each statement as a TRUE or FALSE statement about GOOD research as discussed by Badke

View Set

Academic and Professional Writing

View Set

NURS 3107 - Exam 4 - Saunders: Integumentary

View Set

Survey of Art and Culture Study Guide

View Set

Nutrition: Science and Applications 4e Chapters 1 - 7; 13 - 18; and Focus on Eating Disorders: Test Questions

View Set

Chapter 12: Postpartum Physiological Assessments and Nursing Care

View Set