How can one create an array from a string in PHP?
To create an array from a string in PHP, you can use the `explode()` function. This function splits a string into an array based on a specified delimiter. You simply need to pass the delimiter and the string you want to split as arguments to the `explode()` function.
$string = "apple,banana,orange";
$array = explode(",", $string);
print_r($array);
Related Questions
- How can PHP developers effectively manage CSS inclusion during PDF generation to ensure flexibility and maintainability?
- What steps can be taken to ensure that the breadcrumb module outputs correctly and can be passed to the print link in PHP?
- What potential issues could arise from using strpos() to check for specific cookie keys in PHP?