Section 1

Preview this deck

what are the seven main error reporting constants?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

4 years ago

Date created

Mar 1, 2020

Cards (154)

Section 1

(50 cards)

what are the seven main error reporting constants?

Front

E_NOTICE, E_WARNING, E_PARSE, E_ERROR, E_ALL, E_STRICT, E_DEPRECATED

Back

will print $_GET work? why or why not?

Front

no, because you cannot use the print function on arrays.

Back

what type of variable is $_POST?

Front

predefined variable.

Back

can variable names begin with underscores?

Front

yes.

Back

what is the first argument of the number_format() function?

Front

the number or numeric variable to be formatted.

Back

are variable names case-sensitive?

Front

yes.

Back

what should be used to have multiple quotations in one string?

Front

the escape character '\': $string = "I said \"Hello\" to the man.";

Back

what will error_reporting (E_ALL | E_STRICT) do?

Front

it will show all errors that fall under E_ALL or E_STRICT, the pipe | is used for 'or' so that errors that fall under either will be shown; E_ALL & E_STRICT would be incorrect for this purpose because the error would have to fall under both E_ALL and E_STRICT.

Back

how do you know what to use to get a value from POST or GET?

Front

they are the values of the name attributes of the input tags in the form. $_POST['name'] or $_GET['name'] refers to the value of <input name="name" /> (depending on the method of the form).

Back

what are the four main error types?

Front

Notice, Warning, Parse error, and Error.

Back

what can be used to print data in an array?

Front

not print; print_r (human readable) can be used.

Back

what is the default number of decimals that round() will round to?

Front

no decimals, it will round to the nearest integer.

Back

describe the error type 'Notice'

Front

Notice is not fatal, but may or may not be indicative of a problem: referring to a variable with no value.

Back

will print $_SERVER work? why or why not?

Front

no, because you cannot use the print function on arrays.

Back

when should you use double quotes?

Front

when a variable contains any amount of variables; in general.

Back

what will error_reporting (E_ALL) do?

Front

it will show all error reporting.

Back

what type of variable is $_SERVER

Front

$_SERVER is a predefined variable.

Back

is data shown in the URL if POST is used?

Front

no; use for passwords, pages that would not be bookmarked, pages that require security.

Back

what are some basic arithmetic operators?

Front

+ addition - subtraction * multiplication / division

Back

where is data sent using POST found?

Front

predefined variable $_POST

Back

how can you set up error reporting?

Front

with the function error_reporting();

Back

can variable names begin with numbers?

Front

no.

Back

what is the optional second argument of the round() function?

Front

the number of decimal places to round to. round(12.4958670, 3) will yield 12.496

Back

what function can you use to format a number with commas?

Front

number_format()

Back

what can you use to display errors in a particular script?

Front

ini_set ('display_errors', 1); should be placed at top of script.

Back

besides GET and POST, what other predefined variable can you use to access data?

Front

$_REQUEST, but $_POST and $_GET are more precise, and therefore preferable.

Back

why should you use comments before you shorthand variables for POST and GET?

Front

so you know which values are being passed from the form. // feedback.html passes title, name, email, response, comments $title = $_POST['title'] ...

Back

how can you put a dollar sign before a variable like $10 where 10 is the variable's value?

Front

you can escape the first dollar sign; \$$cost; or you can use curly braces; ${$total}

Back

describe the error type 'Warning'

Front

Warning is not fatal, but is probably problematic: misusing a function.

Back

what is the first argument of the round() function?

Front

the number or numeric variable to be rounded.

Back

what is an 'index' or 'key'?

Front

what is referred to for a value within an array. $_POST['name'] may be equal to 'Jane Doe' $cards[4] may be equal to 'BMW'

Back

what is the round() function used for?

Front

to round numeric values.

Back

when should you use single quotes?

Front

when there are no variables in the string; if you use single quotes, PHP will not search for variables to replace, which can enhance speed.

Back

what types of arguments are used for error_reporting()?

Front

predefined constants that are not in quotations.

Back

can a string with numbers be used as a number?

Front

yes. $string = "2"; can be used as $string = 2; can be used.

Back

what will error_reporting (E_ALL & -E_NOTICE) do?

Front

it will show all error reporting except for notice errors.

Back

can arrays contain arrays?

Front

yes, they commonly do contain arrays.

Back

what will happen if $_POST['name'] is used in double quotes?

Front

a parse error will occur, to avoid this, create shorthand variables like: $name1 = $_POST['name1']; $name2 = $_POST['name2'];

Back

describe the error type 'Error'

Front

Error is fatal, it is a general fatal error: memory allocation problem.

Back

what type of variable is $_GET?

Front

predefined variable.

Back

what is the second optional argument of the number_format() function?

Front

the number of decimal places to round to. number_format(125939.4958670, 3) will yield 125,939.496

Back

where is data sent using GET found?

Front

predefined variable $_GET

Back

what should the action attribute's value contain?

Front

the URL to the php script that will handle the information in the form.

Back

can variable names contain symbols?

Front

no.

Back

what character must all variables begin with?

Front

the dollar sign $.

Back

what will error_reporting (0) do?

Front

it will not show error reporting, it will be turned off.

Back

is data shown in the URL if GET is used?

Front

yes; use for search engines, catalogued pages, pages that would be bookmarked.

Back

what can the number_format() function be used for? (two answers)

Front

the function will format with commas and the second argument can determine how many decimals to round to.

Back

describe the error type 'Parse error'

Front

Parse error is fatal, caused by a semantic mistake: omission of a semicolon, imbalance of quotations, parentheses, or braces.

Back

will print $_POST work? why or why not?

Front

no, because you cannot use the print function on arrays.

Back

Section 2

(50 cards)

is round($num) the same as round ($num)

Front

yes, spaces are optional and not required after a function.

Back

how many arguments can isset() take?

Front

any amount.

Back

what if you want to use trim() for the beginning of a string?

Front

you can use ltrim() (as in left-trim), because the left is the beginning of the string.

Back

what is a control structure?

Front

a conditional or loop.

Back

what can you use to case-sensitively replace substrings with other strings?

Front

str_replace()

Back

what can strlen() be used for?

Front

to find the length of a string; strlen('Hello, world!') would yield 13

Back

what can strip_tags() be used for?

Front

removes all HTML and PHP tags.

Back

what can empty() be used for?

Front

to check if a given variable has an "empty" value - no value, 0, or FALSE.

Back

what can wordwrap() do?

Front

word wrap after a certain amount of characters.

Back

what can str_word_count() be used for?

Front

to find the amount of words in a string.

Back

what function can be used to find the absolute value of a number or numeric variable?

Front

abs()

Back

what can trim() be used for?

Front

to remove any white space - spaces, newlines, tabs - from the beginning and end of a string, not the middle.

Back

what are the first and second optional arguments of rand()?

Front

the lower limit and the upper limit for $num = rand(0, 10) $num must be between 0 and 10.

Back

what can strtok() be used for?

Front

to create a substring (referred to as a token) from a larger string; $first = strtok($_POST['name'], ' ') finds first name because first and last name is separated by a space.

Back

what can is_numeric() be used for?

Front

to check if a variable has a valid numerical value; strings with numerical values pass.

Back

define precedence

Front

the order of operations.

Back

what can htmlentities() be used for?

Front

converts all HTML tags into their entity versions. <span> -> &lt;span&gt;

Back

what tag begins a php script?

Front

<?php

Back

what happens if you omit the third argument of substr()?

Front

the substring will contain the rest of the string starting at the index value provided by the second argument.

Back

what number do indices begin at?

Front

zero, and they continue to the length of the string minus one.

Back

what can crypt() be used for?

Front

to encrypt values; it is a one-way encryption method, but you can compare $data to crypt($string), if, say, $string is a password as user has entered and $data is the password on file.

Back

what shorthand can you use to increment? decrement?

Front

$var++ and $var-- respectively.

Back

what function can be used to round down to the lowest integer?

Front

floor()

Back

can parentheses be used in conditional statements to set precedence?

Front

yes.

Back

what tag ends a php script?

Front

?>

Back

list some comparison operators

Front

== equality != inequality < less than > greater than <= less than or equal to >= greater than or equal to

Back

can negative numbers be used with substr() to count backward?

Front

yes.

Back

what counters htmlentities()?

Front

html_entity_decode()

Back

what can isset() be used for?

Front

to check if a variable has any value (including 0, FALSE, or an empty string). $var1 = 0; $var 2 = 'something'; isset(var1); // TRUE isset(var2); // TRUE isset(var); // FALSE

Back

what function can you use to create a random number?

Front

rand() function.

Back

what can urldecode() be used for?

Front

when applied, the value is decoded from its encoded nature; firstname+last name -> firstname lastname.

Back

what can str_ireplace() be used for?

Front

to replace a substring with another string; $me = 'first i. last'; $me = str_ireplace('i.', 'initial', $me); print $me; // 'first initial last' it is not case-sensitive.

Back

what will happen if there are no numbers to round? round (12, 2)

Front

zeros will be added to the end.

Back

what will strip_tags(nl2br($string)) do?

Front

nl2br will replace any new lines in $string with <br /> tags, and then strip_tags will remove any HTML or PHP tags, including the just inserted <br /> tags; use nl2br(strip_tags($string)) instead.

Back

how does round() handle 0.5, 0.05, etc. rounds?

Front

half the time it rounds up, half the time it rounds down.

Back

what number do indices end at?

Front

the length minus one, and they always begin at zero.

Back

what is the concatenation assignment operator?

Front

.= $greeting = 'hello, '; $greeting =. 'world!'; $greeting yields 'hello, world!'

Back

what can urlencode() be used for?

Front

when applied, the value can be passed safely through the URL (GET).

Back

what is the function getrandmax() for?

Front

it contains the highest value that rand() can have randomly

Back

what operator can you use to find the remainder of $x divided by $y?

Front

$z = $x % $y; $z will yield the remainder of $x / $y

Back

what is the nl2br() function used for?

Front

to convert new lines in a variable from a form to <br /> tags so that the data can be formatted correctly.

Back

what is the concatenation operator?

Front

the period; .

Back

what can htmlspecialchars() be used for?

Front

it converts certain HTML tags into their entity versions. <span> -> &lt;span&gt;

Back

what if you want to use trim() for the end of a string?

Front

you can use rtrim() (as in right-trim), because the right is the end of the string.

Back

what can substr() be used for?

Front

to find a substring in a larger string using indices; $sub = substr($string, 2, 10) assigns $sub ten characters of $string starting at the second character of $string.

Back

what two conditionals does PHP have?

Front

if and switch.

Back

what function can be used to round up to the highest integer?

Front

ceil()

Back

define concatenate

Front

to append; add a string to the end of another string.

Back

what operators can you use to operate and assign?

Front

+=, -=, *=, /= $num += 5 will yield $num + 5 $num /= 5 will yield $num / 5

Back

list some logical operators

Front

! negation AND and && and OR or || or XOR or not

Back

Section 3

(50 cards)

what are the seven main SQL functions?

Front

alter - modifies existing table; create - creates database or table; delete - deletes records from a table; drop - deletes a database or table; insert - adds records to a table; select - retrieves records from a table; update - updates records in a table;

Back

what are the three types of loops in PHP?

Front

for, while, foreach.

Back

how do you create an array?

Front

with the array() function; $groceries = array('apples', 'bananas', 'oranges'); first element is assigned key 0 by default.

Back

how can you sort the values while maintaining the correlation between each value and its key?

Front

the asort() function; arsort() can be used for reversed order; asort($array);

Back

what is the for loop designed to do?

Front

to perform specific statements for a determined number of iterations

Back

how can you iterate over the values of an array?

Front

for ($i = 0; $i < count($array); $i++) {statement(s);}

Back

what function can be used to get time data?

Front

the date() function; date('formatting').

Back

what does ksort() sort by?

Front

keys; key-values maintained.

Back

how can you sort by the keys while maintaining the correlation between the key and its value?

Front

the ksort() function; krsort() can be used for reversed order; ksort($array);

Back

does rsort() maintain key-values?

Front

no.

Back

what do natsort() and natcasesort() do?

Front

they sort using natural order while maintaining key-value; name2 is placed before name12; sort() would place name12 before name2.

Back

what does rsort() sortby?

Front

reversed values; key-values not maintained.

Back

what can you do to delete an element of an array?

Front

use the unset() function; unset($array[7]);

Back

how can you assign keys to the values in an array?

Front

with the array() function; $groceries = array(1 => 'apples', 2 => 'bananas', 3 => 'oranges'); $groceries = array( 1 => 'apples', 2 => 'bananas', 3 => 'oranges' ); the key does not have to be a number.

Back

what is a superglobal

Front

$_SERVER, $_POST, $_GET, $_COOKIE, $_SESSION, $_ENV; special arrays.

Back

what is the while loop designed to do?

Front

to run until a condition is FALSE; for (initial expression; condition; closing expression) {statement(s);}

Back

how do you refer to an element in a multidimensional array?

Front

listing the indices in order of general to more precise; $meats = ('turkey', 'ham', 'chicken'); $vegetables = ('broccoli', 'lettuce', 'tomato'); $foods = array($meats, $vegetables); print $foods[1][1]; // lettuce print $foots[0][0]; // broccoli

Back

how can you discern if a constant is already declared?

Front

by using the defined() function; defined('CONSTANT'); usually used with conditional statements.

Back

how can you iterate over the keys and values of an array?

Front

with the foreach loop; foreach ($array as $key => $value) {statement(s);} foreach ($array as $k => $v) {statement(s);}

Back

what function can you use to find how many substrings are in a string?

Front

the substr_count(); substr_count($_POST['email'], '@') // counts @ signs in $_POST['email']

Back

how do you declare a constant?

Front

by using the define() function; define ('CONSTANT', value); constants are usually capitalised, but do not have to be; you DO NOT use dollar signs - they are constants not variables.

Back

what control structure does break exit?

Front

if/elseif/else and switch statements.

Back

does arsort() maintain key-values?

Front

yes.

Back

how can you sort values of an array without regard to the keys?

Front

the sort() function; rsort() can be used for reversed order; sort($array);

Back

what does sort() sort by?

Front

values; key-values not maintained.

Back

how can you convert an array into a string?

Front

with the implode() function; join() also works; $string = implode(glue, $array);

Back

does sort() maintain key-values?

Front

no.

Back

does asort() maintain key-values?

Front

yes.

Back

what can you use to merge arrays?

Front

the function array_merge(); $new_array = array_merge($array1, $array2); or you can use the + or += operators appropriately: $soups = $soups + $soups2; $soups += $soups2;

Back

what is an indexed array?

Front

an array whose keys are numbers.

Back

does krsort() maintani key-values?

Front

yes.

Back

how can you iterate over the values of an array, but not the keys?

Front

with the foreach loop; foreach ($array as $value) {statement(s);}

Back

how can you convert a string into an array?

Front

with the explode() function; $array = explode(separator, $string);

Back

what can you do to determine the amount of elements in an array?

Front

use the count() function; $howmany = count($array);

Back

what is an associative array?

Front

an array whose keys are strings; also known as a hash.

Back

what can you do to delete a variable?

Front

use the unset() function; unset($var); unset($array[7]);

Back

how can the list() function be used?

Front

to assign array element values to individual variables; $date = array('Thursday', 23, 'October'); list($weekday, $day, $month) = $date; now a $weekday, $day, $month variable exist, with respective values; must be indexed, beginning with 0; arguments cannot be omitted but can be ignored; list($weekday, ,) = $date;

Back

what does asort() sort by?

Front

values; key-values maintained.

Back

how do you append elements to an array?

Front

$array[] = item; will assign item to the next available index; associative arrays get messy.

Back

what does SQL stand for?

Front

structured query language.

Back

how can you create an array with an HTML form?

Front

by making the name attribute equal to the name of the array, and the value equal to the value of an element of the array; this makes $_POST or $_GET multidimensional.

Back

what can you do to reset an array?

Front

reassign the array() function to the array; $array = array();

Back

what functions can you use to include files?

Front

include() and require(); include() will give errors, require() will terminate execution().

Back

what control structure does continue exit?

Front

loops; any statements after the continue are not executed, but the condition of the loop is checked again afterward.

Back

what does krsort() sort by?

Front

reversed keys; key-values maintained.

Back

how can you reorganise the array randomly?

Front

the shuffle() function; shuffle($array);

Back

if you are worried about quotation marks while using arrays, what should you use?

Front

curly braces; print "<p>Monday's soup is {$soups['Monday'[}.</p>";

Back

does ksort() maintain key-values?

Front

yes.

Back

how do you refer to an item in an array?

Front

$varname[key]; keys can be numbers or strings.

Back

what does arsort() sort by?

Front

reversed values; key-values not maintained.

Back

Section 4

(4 cards)

what is the syntax for connecting to a database?

Front

$dbc = mysql_connect(hostname, username, password);

Back

what does fopen() do?

Front

creates a pointer to a file with the declared mode (read, write, etc.).

Back

how do you close a connection between a database?

Front

mysql_close($dbc);

Back

what are the possible modes for fopen()?

Front

r reading only; begin reading at the start of the file; r+ reading or writing; begin at the start of the file; w writing only; create the file if it does not exist, and overwrite any existing contents; w+ reading or writing; create the file if it does not exist, and overwrite any existing contents (when writing); a writing only; create the file if it does not exist, and append the new data to the end of the file; a+ reading or writing; create the file if it does not exist, and append the new data to the end of the file (when writing); x writing only; create the file if it does not exist, but do nothing (and issue a warning) if the file does exist. x+ reading or writing; create the file if it does not exist, do nothing (and issue a warning) if the file already exists (when writing); b can be paired with any of the above modes, which forces the file to open in binary mode (safer).

Back