Made with ScholarlyMake flashcards like these from your own notes
Question:What operator is used to concatenate two strings in PHP?
Answer:The . operator
Question:How do you add a space between concatenated strings using the . operator?
Answer:By inserting " " between the strings
Question:What is a simpler way to concatenate strings with a space using double quotes?
Answer:Surround variables in double quotes with space: "$x $y"
Question:What function is used for slicing a string in PHP?
Answer:substr()
Question:What are the parameters for the substr() function?
Answer:Start index and length (number of characters)
Question:What does the index start from in PHP strings?
Answer:0 for the first character
Question:How do you slice a string to the end using substr()?
Answer:Omit the length parameter
Question:How are negative indices used in substr() for slicing from the end?
Answer:Negative values count backwards from the end (-1 is last character)
Question:What does a negative length in substr() do?
Answer:Omits characters from the end
Question:What is an escape character in PHP strings?
Answer:A backslash \ followed by the character to insert
Question:How do you escape a double quote inside a double-quoted string?
Answer:Use \"
Question:What are some common escape sequences in PHP?
Answer:\' for single quote, \" for double quote, \$ for variables, \n for new line
Question:What are the three main numeric types in PHP?
Answer:Integer, Float, Number Strings
Question:How are numeric variables created in PHP?
Answer:By assigning a numeric value to them
Question:What function verifies the type of a variable in PHP?
Answer:var_dump()
Question:What is an integer in PHP?
Answer:A non-decimal number between certain limits (e.g., -2147483648 to 2147483647 in 32-bit)
Question:What happens if a number exceeds integer limits in PHP?
Answer:It is stored as a float
Question:What are the rules for integers in PHP?
Answer:At least one digit, no decimal point, can be positive or negative
Question:What formats can integers be specified in PHP?
Answer:Decimal (base 10), hexadecimal (0x), octal (0), binary (0b)
Question:What PHP constant represents the largest integer?
Answer:PHP_INT_MAX
Question:What functions check if a variable is an integer in PHP?
Answer:is_int(), is_integer() (alias), is_long() (alias)
Question:What is a float in PHP?
Answer:A number with a decimal point or in exponential form
Question:What is the maximum precision for floats in PHP?
Answer:14 digits
Question:What PHP constant is the largest representable float?
Answer:PHP_FLOAT_MAX
Question:What functions check if a variable is a float in PHP?
Answer:is_float(), is_double() (alias)
Question:What does PHP stand for?
Answer:PHP: Hypertext Preprocessor
Question:Where are PHP scripts executed?
Answer:On the server
Question:What file extension do PHP files have?
Answer:.php
Question:What can PHP do with files on the server?
Answer:Create, open, read, write, delete, and close them
Question:Why is PHP popular?
Answer:Runs on various platforms, compatible with many servers, supports wide range of databases
Question:How does a PHP script start and end?
Answer:<?php and ?>
Question:What ends PHP statements?
Answer:A semicolon (; )
Question:What is the echo statement used for in PHP?
Answer:To output text to the browser
Question:Are PHP keywords case-sensitive?
Answer:No, keywords like if, echo are not case-sensitive
Question:Are PHP variable names case-sensitive?
Answer:Yes, $color differs from $Color
Question:What is the purpose of comments in PHP?
Answer:To explain code, remind of logic, or temporarily disable parts
Question:How do you write a single-line comment in PHP?
Answer:Using // or #
Question:How do you write a multi-line comment in PHP?
Answer:Using /* and */
Question:What is the result of concatenating "Hello" and "World" without space?
Answer:HelloWorld
Question:What does substr($x, 6, 5) return for $x = "Hello World!"?
Answer:World
Question:What does substr($x, -5, 3) return for $x = "Hello World!"?
Answer:rld
Question:What does substr($x, 5, -3) return for $x = "Hi, how are you?"?
Answer:ow are y
Question:What is the range for integers in 32-bit PHP systems?
Answer:-2147483648 to 2147483647
Question:Why is 4 * 2.5 stored as float in PHP?
Answer:Because one operand is a float
Question:What is PHP_INT_SIZE?
Answer:The size of an integer in bytes
Question:What is an example of a float in exponential form?
Answer:7.64E+5
Question:What can PHP output besides HTML?
Answer:Images, PDF files, XHTML, XML
Question:What is a simple PHP file structure?
Answer:Contains HTML tags and PHP code between <?php ?>
Question:In the example, why does only $color display value?
Answer:Because variables are case-sensitive
Question:Where can a single-line comment be placed?
Answer:Before or at the end of a line