PHP Questions Flashcards

1
Q

What does (=) do?

A

Assigns a value

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

What does (==) do?

A

Checks if values are the same

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

What does (===) do?

A

Checks if values are the same and of same type

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

What does echo do?

A

Outputs what is passed to it

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

What does print do?

A

Outputs what is passed to it and acts as function for passing comples statements

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

What does printf do?

A

Used for formatting output

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

What does include do?

A

Includes a file each time it’s called

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

What does include_once do?

A

Will only include file when first called

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

What does require do?

A

Same as include but results in error if file not found

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

How are variables passed to functions?

A

By value unless it is passed with an ‘&’, which would make it by reference

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

What is the differance between crypt() and md5()?

A

crypt() is used for encrypting something that be decrypted later. md5() produces a hash, which cannot be decrypted

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

What are PHP Statics?

A

Elements that can be accessed from any context. Like calling a method from another class without needing to instantiate that class

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

What is POST?

A

An array of variable passed via http post method

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

What is GET?

A

Array of variable passed via http url parameters

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

What is SESSION?

A

Array of variables that can be preserved accross acccess of a site, usually stored in memory or database

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

What is inheritance?

A

Mechanism of deriving a new class from an existing class while keeping attributes and behaviors of parent class

18
Q

What is polymorphism?

A

Classes with differant functionality while sharing a common interface

19
Q

What is an abstract class?

A

A mix between an interface and a class. It defines a class that must be extended in order to be used.

20
Q

What is encapsulation?

A

Wrapping of data within an object with data structures and methods to act on them

21
Q

Whats differant in PHP 5 over PHP 4

A

Static methods and properties, visibility propherties (public, private, protected), constructors and destructors, abstract classes, interfaces, magic metods, autoload, type hinting, exceptions

22
Q

What does public property do?

A

Allows a method or property to be accessible and modifiable by everyone

23
Q

What does private property do?

A

Makes methods and properties available to the class they reside in only

24
Q

What does protected property do?

A

Makes methods and properties available to class they reside in, and child or parent classes

25
Q

What are interfaces?

A

An interface defines the methods a class must implement without having to define how they are handled

26
Q

What are magic methods?

A

PHP functions with reserved names startng with ‘__’ : __call()

27
Q

What does type hinting do?

A

Allows for enforcement of variable types passed to functions or methods

28
Q

What is registered globals?

A

PHP setting that allows for creation of global variables for many server variable and query string parameters - should be off