Recall & Review
beginner
What is an integer in PHP?
An integer in PHP is a whole number without a decimal point. It can be positive, negative, or zero.
Click to reveal answer
intermediate
What happens when an integer exceeds the platform's maximum size in PHP?
When an integer exceeds the platform's maximum size, PHP converts it to a float (floating-point number) automatically.
Click to reveal answer
beginner
How can you check if a variable is an integer in PHP?
You can use the function
is_int() or is_integer() to check if a variable is an integer.Click to reveal answer
intermediate
What is the size of an integer on a 64-bit PHP platform?
On a 64-bit platform, integers can typically hold values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Click to reveal answer
beginner
Can integers in PHP be written in different number bases? Give examples.
Yes, integers can be written in decimal (e.g., 42), octal (e.g., 052), hexadecimal (e.g., 0x2A), and binary (e.g., 0b101010).
Click to reveal answer
Which function checks if a variable is an integer in PHP?
✗ Incorrect
The function is_int() returns true if the variable is an integer.
What happens if an integer value exceeds PHP's maximum integer size?
✗ Incorrect
PHP automatically converts integers that exceed the max size to floats.
Which of these is a valid hexadecimal integer in PHP?
✗ Incorrect
0x1A is a hexadecimal integer; 0b1010 is binary, 052 is octal, and 42 is decimal.
On a 64-bit system, what is the approximate maximum integer value PHP can hold?
✗ Incorrect
On 64-bit systems, PHP integers can hold values up to 2^63 - 1.
Which of these is NOT a valid way to write an integer in PHP?
✗ Incorrect
08 is invalid because numbers starting with 0 are octal, and 8 is not a valid octal digit.
Explain how PHP handles integers that are too large for the platform's integer size.
Think about what PHP does when numbers get too big.
You got /3 concepts.
Describe the different number bases you can use to write integers in PHP and give an example for each.
Remember the prefixes for each base.
You got /5 concepts.