Unit 2 Flashcards

1
Q

Outline PHP’s variable conventions.

A
  1. They start with a dollar sign
  2. Variable type is not required when defining them
  3. They must start with a letter or underscore
  4. They cannot contain spaces
  5. Variable names are case-sensitive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Outline the conventions of a constant variable

A
  1. They are case sensitive
  2. Always uppercase
  3. Starts with a letter or underscore
  4. Automatically possess a global scope
  5. They are created using define() function and const keyword
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between const and define() in creating constant variables in PHP?

A

The keyword “const” defines constants at compile time, whereas the define() function defines constants at run time.

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

What are the scalar data types in PHP?

A

bool, int, string, float

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

What are the compound data types?

A

array, object, callable, iterable

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

What are the special data types in PHP?

A

resource, NULL

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

What are the three types of arrays in PHP?

A
  1. Indexed array
  2. Associative array
  3. Multi-dimensional array
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the === operator do?

A

Returns true if both variables are equal and of the same type.

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

What does the <> operator do?

A

Returns true if both variables are not equal.

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

What does !== operator do?

A

Returns true if both operators are not equal or they are not of the same type

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

What does <=> operator do?

A

Spaceship returns an integer less than, equal to, or greater than zero, depending on if the variable on the left is less than, equal to, or greater than the variable on the right.

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

What does xor produce?

A

True if either variables is true, but not both

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

What is the concatenation operator?

A

.

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