Web Programming - Week 5 Flashcards

1
Q

What are dynamic web pages

A

Web pages that are not prebuilt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Advantages and Disadvantages of dynamic web pages

A

Advantages: Dynamic and Interactive
Disadvantages: Slower than Static web pages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Dynamic web page languages

A

PHP, Python, ASP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

PHP Basics

A

PHP Files have extension .php
A PHP script starts with < ?php ends with ? >
PHP can be embedded in HTML
PHP statements are terminated by a semicolon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Comments in PHP

A
# or // - Single line
/* */ - Multi line
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

PHP Variable Syntax

A

$variable_name = value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

PHP Strings

A

Enclosed in single or double quotes

Concatenated with .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Interpolated variables

A

Double quotes interpolates variables in a string, single quotes do not

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Output in PHP

A

Browser only shows front end, PHP script is replaced by its output in HTML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Print in PHP

A

print() - prints 1 value

print_r() - prints structured values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Echo in PHP

A

Not a function so no brackets needed

Like print function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

foreach syntax

A
foreach ($myArray as $value){
 //statements ;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

DataType check function

A

is_datatype($v)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Number Array Syntax

A

$array_name = array(“Value1”, “Value2”, etc…) ;

OR 0 => “Value1” etc…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Associative Array Syntax

A

$array_name = array(“Name1”=Value1, “Name2”=Value2, etc…) ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Associative Array foreach

A
foreach ($myArray as $name=>$val){
 //statements ;
}
17
Q

Array functions

A

sizeof()
count()
sort()
array_merge()

array_push() - Inserts one or more elements to the end of an array

18
Q

Encode array to JSON format function

A

json_encode()

19
Q

Function Syntax

A
function functionName ($arg1, $arg2,...){
 //statements ;
}
20
Q

Calling a function

A

$returnVal = functionName($arg1, $arg2,…)

21
Q

Modify variable outside function

A

Requires & operator