Which predefined PHP function is used to find the position of the first occurrence of a substring?
- strpos($string, $substring)
- strfind($string, $substring)
- strstrpos($string, $substring)
- locate($substring, $string)
The correct option is 'strpos($string, $substring)'. It is used to find the position of the first occurrence of a substring within a string. The other options are incorrect functions.
Loading...
Related Quiz
- In PHP, a callback function is a function that is passed as an argument to another function.
- You are tasked with creating a report that combines data from a "sales" table and a "products" table. The requirement is to list all products, even those that haven't made a sale. Which JOIN operation would you choose?
- In PHP, a function is a self-contained block of code that performs a specific task.
- How is a multi-line comment denoted in PHP?
- In PHP, integers can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8), and ______ (base 2) format.