Data Types in PHP Flashcards

1
Q

What defines the type of data a variable can store in PHP?

A

Data Types

PHP allows eight different types of data types.

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

How many simple data types are there in PHP?

A

Five

The first five data types are called simple data types.

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

What is an Integer in PHP?

A

Whole numbers, both positive and negative

Example: $age = 25;

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

What is a Float (Double) in PHP?

A

Numbers with decimal points

Example: $price = 19.99;

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

What does the NULL data type represent in PHP?

A

A special type that can hold only one value, i.e., NULL

Example: $var = NULL;

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

What is a String in PHP?

A

A sequence of characters enclosed in quotes

Example: $name = ‘John Doe’;

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

What values can a Boolean hold in PHP?

A

TRUE or FALSE

Example: $isActive = true;

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

What is an Array in PHP?

A

A compound data type that can store multiple values of the same data type

Example: $fruits = array(‘Apple’, ‘Banana’, ‘Cherry’);

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

What are Objects in PHP?

A

Instances of user-defined classes that can hold both values and functions

Objects allow encapsulation of data and behavior.

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

What are Resources in PHP?

A

Not an exact data type; used to store references to function calls or external PHP resources

Example: Consider a database call.

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