Lecture 6 - ServerSideScripting I Flashcards
What does PHP stand for?
PHP: HyperText Preprocessor
The web server does what three things with php?
Interprets, processes and renders
What interprets, processes and renders php?
a web server
What language can handle complex data processing that allows for dynamic content?
php
Can PHP handle both new and permanently stored data?
Yes!
What does LAMP stand for?
Linux, Apache, MySQL, PHP
can the closing tag… ?>… be omitted on occasions?
Yes. Sometimes it is purposefully omitted.
What is the difference between echo and print?
They are mostly the same aside from the fact that echo has no return value and print returns a value of 1. Echo can take multiple parameters, but print can only take one.
What are three ways to comment in PHP?
//this is a comment /*This is a comment*/ #This is a comment
What does a php script consist of?
a series of commands and statements
What is each statement terminated with
A semicolon (;)
What do php statements do?
Call for functions and provide parameters
Can a function have more than one parameter?
yes! Each parameter is separated by a comma.
Name two built-in php functions
The include function and the require function
What is the difference between failure of an include file and a required file?
Include: In case of failure, a warning will be generated.
Require: In case of failure, the execution of the script will be terminated.
Php scripts are executed on the server, but can we see php code when we “View Source” in our browser?
No! Only html is visible
Use PHP to echo a date
echo date(‘I, F ds Y.’);
Is PHP a loosely typed language?
Yes! Good job!
What can we do to variables in php?
They can be altered, printed to the browser, saved to a database, emailed, etc.
What are variable names always preceded with?
$
Is this var name okay or illegal?
$3fifteen
No, the first char after $ must be a letter or underscore
How do you concatenate in php?
with a period: $example = ‘Hi’ . ‘there’;
What is variable interpolation?
The process of converting a variable name into their actual value. Use “” instead of ‘’.
”” prints value
‘’ prints var name
What does an array look like in PHP?
$myArray = array(‘item1’=>’my value’, ‘item 2’=>’another value’);
What is an indexed array?
These use numbers as indices to point to the values they contain.
What is an associative array?
The array’s values are associated with meaningful indices
How do you print the contents of an array in php?
print_r()
What is $_REQUEST used for?
Used when requesting a variable regardless of it being sent as part of the query string (i.e., $_GET) or a form post (i.e., $_POST)
What are objects used for?
Storing instances of classes
When is a Task Flow useful?
When dealing with forms, it is recommended to use one.