You have a long string containing multiple words and you need to extract each word as an individual item in an array. Which PHP function would be most suitable for this task?
- explode()
- implode()
- split()
- preg_split()
The explode() function in PHP is used to split a string into an array based on a specified delimiter. This is ideal for separating words in a long string into individual array items.
Loading...
Related Quiz
- After installing PHP, you can immediately start running PHP scripts without restarting the server.
- In PHP, constant identifiers are always case-______.
- Which PHP function is used to execute a MySQL query?
- You are building a profile page where users can upload their profile pictures. Which PHP function would you use to ensure the uploaded file is an image type?
- What is the output of the following code? echo count(array("apple", "banana", "cherry"));