PHP Flashcards

1
Q

When clients request a page containing a server-side script, the ______ processes the scripts, then returns the HTML to the client. For example, a PHP page is not processed by the _______. Instead, it’s interpreted by the ______, that can process PHP scripts and then returns the HTML page to the ______.

A

server, browser, client

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

What Is The Current Major Version Of PHP?

A

5.x

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

When PHP runs its code, it runs from top to bottom.

A

true

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

All statements end with a _________ character.

A

semicolon

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

The PHP interpreter ignores whitespace.

A

true

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

How many data types are there in PHP?

A

7

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

Name the 7 data types in PHP.

A

Integers, Floats, Strings, Arrays, Booleans, Objects, Resources

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

What built-in internal function outputs the data type?

A

gettype

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

Most strings in PHP are “x” base index.

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
$greeting = "Hello World";
$greeting{0} = "J";
// what is the value of $greeting?
A

Jello World

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

Anything that is a ___-____ value will always be considered “true”.

A

non-zero

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

Anything that’s empty in any way is always considered _____.

A

false

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

A ________ is unchangeable whereas a ________ is varying. _________ are something we may eventually want to modify; a temporary storage location for information in a program.

A

constant, variable

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

Variables begin with a ______ sign character whereas constants are typically identified by all ____.

A

dollar, caps

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

A string is a series of characters, where a character is the same as a byte.

A

true

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

A ________ is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script. A ________ is ____-_________ by default. By convention, ________ identifiers are always_________.

A

constant, case-sensitive, uppercase

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

$arr = array(“Apples”, “Oranges”, “Blueberries”);

print_r($arr); // ___ _____ pairs.

Array
(
[0] => Apples
[1] => Oranges
[2] => Blueberries
)
A

key value

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

$arr = []; // _________ method.

A

shorthand

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

$arr = array( 12, “green”, 4.65, myFunc(), true ); // _____ data ____ array.

A

mixed, type

20
Q

$eye_colors[] = ‘hazel’; // what is the result of this statement?

A

Append key value pair to end of array.

21
Q

$arr = array(“apples”, “oranges”, “bananas”); // what type of array is this?

A

Indexed / Numeric Array

22
Q

Associate arrays allow us to use a _______ as a key.

A

string

23
Q

$fav_clr = array(“michel” => “green”); // what type of array is this?

A

Associative Array

24
Q

Ternary is pronounced “turn-a-ree”.

A

true

25
Q

Name the 8 most commonly used operator types.

A

comparison, concatenation, unary, binary, ternary, arithmetic, casting, assignments

26
Q

=== // Strict ________ / __________ operator. Equal in both value and type.

A

Strict equality / identical operator.

27
Q

&&, ||

A

Logical operators.

28
Q

There are 4 looping constructs, what are they?

A

for, foreach, while, do…while

29
Q

By default, PHP uses the “passing by _____” method of passing an argument.

A

true

30
Q

There how many methods of passing an argument in regards to how the argument value is affected by a function?

A

2

31
Q

When referring to passing arguments to functions, in which method are the argument values not at all affected by the function outside of that function scope?

A

“passing by value”

32
Q

Passing arguments by “reference” means the value of an argument if modified by the function scope, will be modified outside the function scope as well. This method of passing arguments is referred to as what?

A

“passing by reference”

33
Q

The statement $func() is referred to as what in the following code block?

function answer() {
  return 42;
}
$func = 'answer';
$func();
A

Variable function

34
Q

_________ _________ are functions with no name. These functions are capable of accessing variables outside of the function scope.

A

Anonymous functions

35
Q

A semicolon is required at the end of this type of function.

A

Anonymous function

36
Q

echo “Hello $friends.”; // while double quotes ________ variables in a string, single quotes do not.

A

evaluate

37
Q

In an anonymous functions, to pass through a variable outside the function scope, you use the ___ keyword and pass it the argument variable.

// Example
$name = "Michel";

$greet = function() ___($name) {
return “Hello $name.”;
};

A

use

38
Q

What keyword or method can we use to pass a value into a closure or anonymous function?

A

the “use” keyword

39
Q

a ________ is what we can a variable declared inside a class.

A

property

40
Q

To implement an interface, the __________ operator is used.

A

implements

41
Q

True or false: The constructor method has to be called __construct().

A

true

42
Q

___________ is a way for one class to take on the properties or methods of another class.

A

Inheritance

43
Q

A parent class is also sometimes referred to as a __________ while a child class can be referred to as a ________.

A

superclass, subclass

44
Q

The ______ keyword lets you use a class ________ or ______ without having to create an instance of that class.

A

static, property, method

45
Q

An associative array makes use of ___ and _____ pairs.

A

key => value

46
Q

You can write php in either a __________ (old fashioned) or OOP way.

A

procedural