Week 11 Flashcards

1
Q

In the folder structure, where do PHP files go?

A

o Index goes in the public folder, next to images and stylesheet
o Functions go in the private folder

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

These are used to insert a PHP files contents into the current file before the server executes anything

A

Include() and require()

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

What is the difference between include and require? Include

A

Include() generates a warning but the script will continue, require generates a fatal error, stopping the script

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

PHP I/O - file_get_contents(filename)

A

Contents from a file with made into one large string

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

PHP I/O - file_put_contents(filename, data, mode)

A

Write to a file in one large string

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

PHP I/O - file_exists(filename

A

Does the file exist

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

Glob()

A

Same as Grep. Returns an array of all file names that match a pattern

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

getcwd()

A

Get current working directory

cwd think pwd

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

How can we break a string into an array of strings in PHP?

A

Explode()

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

Limited in size by browser, stored on client side, can be disabled

A

Cookies

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

Stored on server, limited only by server space. No user modifications, expires when browser is closed.

A

Sessions - Often identified by a session id (a cookie)

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

What needs to be called at the top of every page to start a session?

A

session_start()

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

JSON stands for

A

JavaScript Object Notation (

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

o JSON keys are always
o JSON values can be

A

Strings; Strings, Numbers, Bools, Objects, Arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • Why use JSON objects?
A

o Transfer data between the server and the client
Simple to use for data

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

Does JSON have a version?

A

No

17
Q

T/F - JSON can be unstable if used incorrectly

A

False

18
Q

What kind of character encoding does JSON use?

A

Unicode

19
Q

o What data can json_encode be used on?

A

Any data type except resources (A databse or file handle are resources)

20
Q

By default, what type of object does json_decode return?

A

a PHP object

21
Q

o Optional param: $assoc—accepts a Boolean value

What happens if its true or false?

A

 If true the JSON object will decode into an associative array
 If false (default) The JSON object will decode to a PHP object