Create an account
what is the purpose of the semi colon?
it is a separator and used to distinguish one set of instructions from another
what happens if the php file has an html extension instead of PHP?
the php code will not be executed
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.
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 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 _ )
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
What is a string variable used for?
A string variable is used to store and manipulate a piece of text.
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
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
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
What is the switch statement used for in PHP?
to perform one of several different actions based on one of several different conditions.
If you want to select one of many blocks of code to be executed which statement should be used?
What is the primary advantage of using the switch statement?
It avoids avoid long blocks of if..elseif..else code.
What is the advantage of arrays?
Instead of having many similar variables, you can store the data as elements in an array.
how are elements in an array accessed?
Each element in the array has its own ID so that it can be easily accessed.
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 looping statements used for?
Looping statements in PHP are used to execute the same block of code a specified number of times.
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
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 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.
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 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 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 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
What is the disadvantage of using the $_get variable?
the largest variable it can hold is 100 characters
what is the purpose of the $_REQUEST Variable?
The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE.
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 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 PHP date() function used for?
The PHP date() function is used to format a time or a date.
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 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
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 the include() or require() function different?
The two functions are identical in every way, except how they handle errors
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).
Please allow access to your computer’s microphone to use Voice Recording.
Having trouble? Click here for help.
We can’t access your microphone!
Click the icon above to update your browser permissions and try again
Reload the page to try again!Reload
Press Cmd-0 to reset your zoom
Press Ctrl-0 to reset your zoom
It looks like your browser might be zoomed in or out. Your browser needs to be zoomed to a normal size to record audio.
Please upgrade Flash or install Chrome
to use Voice Recording.
For more help, see our troubleshooting page.
Your microphone is muted
For help fixing this issue, see this FAQ.
Star this term
You can study starred terms together