PHP - String FunctionsWhat does the PHP function substr($text, 2, 3) do?AExtracts the first 3 characters of $textBExtracts 2 characters from $text starting at index 3CExtracts 3 characters from $text starting at index 2DExtracts the last 3 characters of $textCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand substr parametersThe first parameter is the string, the second is the start index (0-based), and the third is the length of substring.Step 2: Apply to given functionStarting at index 2 means the third character, and length 3 means extract 3 characters from there.Final Answer:Extracts 3 characters from $text starting at index 2 -> Option CQuick Check:substr(string, 2, 3) = 3 chars from index 2 [OK]Quick Trick: Remember start is zero-based, length is how many chars [OK]Common Mistakes:Confusing start index with lengthThinking start counts from 1 instead of 0Assuming length is mandatory
Master "String Functions" in PHP9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PHP Quizzes Array Functions - Array map function - Quiz 10hard Classes and Objects - Access modifiers (public, private, protected) - Quiz 4medium Classes and Objects - Constructor method - Quiz 7medium Error and Exception Handling - Finally block behavior - Quiz 11easy File Handling - CSV file reading and writing - Quiz 1easy File Handling - CSV file reading and writing - Quiz 8hard Interfaces and Traits - Trait declaration and usage - Quiz 5medium Interfaces and Traits - Why interfaces are needed - Quiz 8hard Interfaces and Traits - Interface vs abstract class vs trait - Quiz 6medium Superglobals and Web Context - Why superglobals exist - Quiz 1easy