Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/37

Click to flip

37 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
What are some of the things that PHP files may contain?
PHP files may contain text, HTML tags and scripts
PHP is a ______-____ scripting language.
server-side
PHP scripts are executed on the server.
A PHP scripting block always starts with _____ and ends with __.
starts with: <?php
ends with: ?>
There are two basic statements to output text with PHP: ____ and _____.
echo and print
What is the syntax of a single-line comment in PHP? What is the syntax for a large comment block?
// to make a single-line comment

/* and */ to make a large comment block
All variables in PHP start with what symbol?
$
Variables may contain _______, _______, or ______.
strings, numbers, or arrays
A variable name can only be made up of what?
alpha-numeric characters and underscores (a-Z, 0-9, and _ )
A variable name must start with a ______ or an __________.
letter or an underscore
What are the 7 PHP Arithmetic Operators?
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus (division remainder)
++ Increment
-- Decrement
What are the 6 PHP Assignment Operators?
=
+=
-=
*=
/=
%=
What are the 6 PHP Comparison Operators
== (equal to)
!= (not equal)
> (greater than)
< (less than)
>= (greater than or equal to)
<= (less than or equal to)
What are the 3 PHP Logical Operators?
&& and
|| or
! not
What is the syntax of an If...Else statement?
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
What is the syntax of an ElseIf statement?
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
What is the syntax of a Switch statement?
switch (expression)
{
case label1:
code to be executed if expression = label1;
break;
case label2:
code to be executed if expression = label2;
break;
default:
code to be executed
if expression is different
from both label1 and label2;
}
Name and describe the three different kind of arrays?
Numeric array - An array with a numeric ID key
Associative array - An array where each ID key is associated with a value
Multidimensional array - An array containing one or more arrays
What is the syntax for a basic Numeric Array?
$example = array("Var1","Var2","Var3");
What is the syntax for assigning the ID values manually in a Numeric Array?
$example[0] = "Var1";
$example[1] = "Var2";
$example[2] = "Var3";
In an associative array, each ID key is associated with a value.

What is the basic syntax for an Associative Array?
$example = array("Var1"=>32, "Var2"=>30, "Var3"=>34);
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 is the basic syntax for this type of Array?
$families = array
(
"Var1"=>array
(
"Sub1Var1",
"Sub1Var2",
"Sub1Var3"
),
"Var2"=>array
(
"Sub2Var1"
"Sub2Var2"
),
"Var3"=>array
(
"Sub3Var1",
"Sub3Var2",
"Sub3Var2"
)
);
Each element can contain any number of sub elements.
The while loop - loops through a block of code if and as long as a specified condition is true. What is the syntax for this loop?
while (condition)
code to be executed;
The do...while - loops through a block of code once, and then repeats the loop as long as a special condition is true. What is the syntax for this loop?
do
{
code to be executed;
}
while (condition);
The for loop - loops through a block of code a specified number of times. What is the syntax for this loop?
for (initialization; condition; increment)
{
code to be executed;
}
The foreach loop - loops through a block of code for each element in an array. What is the syntax for this loop?
foreach (array as value)
{
code to be executed;
}
What is the syntax for a function?
function function_name()
{
code goes here;
}
Using the function:

function writeMyName()

Where would you specify any parameters?
The parameters are specified inside the parentheses.
Using thwe following function:

function add($x,$y)
{
$total = $x + $y;
}

How would you retrieve the value of the variable $total (keyword syntax)?
return $total;
True or False: When dealing with HTML forms and PHP, any form element in an HTML page will automatically be available to your PHP scripts.
True
User input should be validated whenever possible. If the form accesses a database, what kind of validation should be used:

a) client side validation
b) server side validation
b) server side validation
Client side validation is faster, and will reduce server load. However, any site that gets enough traffic to worry about server resources, may also need to worry about site security.
Should the $_GET form method be used to store and send sensitive information such as passwords?
No! When using the $_GET variable all variable names and values are displayed in the URL. So this method should not be used when sending passwords or other sensitive information!
What variable is an array of variable names and values sent by the HTTP GET method?
$_GET
The $_GET variable is used to collect values from a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and it has limits on the amount of information to send. What is the maximum number of characters it can send?
max. of 100 characters
The PHP $_REQUEST variable can be used to get the result from form data sent with both the ___ and ____ methods.
GET and POST
The PHP _________ variable contains the contents of both $_GET, $_POST, and $_COOKIE.
$_REQUEST
The ______ variable is used to collect values from a form with method="post".
$_POST
There are a few good reasons to use $_POST such as:

* Variables sent with HTTP POST are not shown in the URL
* Variables have no length limit
What is the one disadvantage to using this $_POST?
Because the variables are not displayed in the URL, it is not possible to bookmark the page.