/
PHP Basics Flashcards
Save to my account
Sign up
PHP Basics Flashcards
PHP Basics Flashcards
Study
1
Question
What operator is used to concatenate two strings in PHP?
Page 1
Answer
The . operator
2
Question
How do you add a space between concatenated strings using the . operator?
Page 1
Answer
By inserting " " between the strings
3
Question
What is a simpler way to concatenate strings with a space using double quotes?
Page 1
Answer
Surround variables in double quotes with space: "$x $y"
4
Question
What function is used for slicing a string in PHP?
Page 1
Answer
substr()
5
Question
What are the parameters for the substr() function?
Page 1
Answer
Start index and length (number of characters)
6
Question
What does the index start from in PHP strings?
Page 2
Answer
0 for the first character
7
Question
How do you slice a string to the end using substr()?
Page 2
Answer
Omit the length parameter
8
Question
How are negative indices used in substr() for slicing from the end?
Page 2
Answer
Negative values count backwards from the end (-1 is last character)
9
Question
What does a negative length in substr() do?
Page 2
Answer
Omits characters from the end
10
Question
What is an escape character in PHP strings?
Page 2
Answer
A backslash \ followed by the character to insert
11
Question
How do you escape a double quote inside a double-quoted string?
Page 3
Answer
Use \"
12
Question
What are some common escape sequences in PHP?
Page 3
Answer
\' for single quote, \" for double quote, \$ for variables, \n for new line
13
Question
What are the three main numeric types in PHP?
Page 4
Answer
Integer, Float, Number Strings
14
Question
How are numeric variables created in PHP?
Page 4
Answer
By assigning a numeric value to them
15
Question
What function verifies the type of a variable in PHP?
Page 4
Answer
var_dump()
16
Question
What is an integer in PHP?
Page 4
Answer
A non-decimal number between certain limits (e.g., -2147483648 to 2147483647 in 32-bit)
17
Question
What happens if a number exceeds integer limits in PHP?
Page 4
Answer
It is stored as a float
18
Question
What are the rules for integers in PHP?
Page 4
Answer
At least one digit, no decimal point, can be positive or negative
19
Question
What formats can integers be specified in PHP?
Page 4
Answer
Decimal (base 10), hexadecimal (0x), octal (0), binary (0b)
20
Question
What PHP constant represents the largest integer?
Page 5
Answer
PHP_INT_MAX
21
Question
What functions check if a variable is an integer in PHP?
Page 5
Answer
is_int(), is_integer() (alias), is_long() (alias)
22
Question
What is a float in PHP?
Page 5
Answer
A number with a decimal point or in exponential form
23
Question
What is the maximum precision for floats in PHP?
Page 5
Answer
14 digits
24
Question
What PHP constant is the largest representable float?
Page 5
Answer
PHP_FLOAT_MAX
25
Question
What functions check if a variable is a float in PHP?
Page 6
Answer
is_float(), is_double() (alias)
26
Question
What does PHP stand for?
Page 7
Answer
PHP: Hypertext Preprocessor
27
Question
Where are PHP scripts executed?
Page 7
Answer
On the server
28
Question
What file extension do PHP files have?
Page 7
Answer
.php
29
Question
What can PHP do with files on the server?
Page 7
Answer
Create, open, read, write, delete, and close them
30
Question
Why is PHP popular?
Page 7
Answer
Runs on various platforms, compatible with many servers, supports wide range of databases