You can do the following using array_map:
$new_arr = array_map('trim', explode(',', $str));
More Related Contents:
- PHP string explode with regular expression? [closed]
- Transposing multidimensional arrays in PHP
- Split a comma-delimited string into an array?
- How to filter an array by a condition
- Convert backslash-delimited string into an associative array
- PHP explode the string, but treat words in quotes as a single word
- Convert a comma-delimited string into array of integers?
- Php multiple delimiters in explode [duplicate]
- How to select first 10 words of a sentence?
- How do I include the split delimiter in results for preg_split()?
- Unexpected bracket ‘[‘ – PHP [duplicate]
- Split string by delimiter, but not if it is escaped
- PHP: How can I explode a string by commas, but not wheres the commas are within quotes?
- How to remove the leading character from a string?
- PHP: Split string into array, like explode with no delimiter
- Explode string into array with no empty elements?
- Explode string by one or more spaces or tabs
- Add a prefix to each item of a PHP array
- PHP ltrim behavior with character list
- Php how to remove any last commas [duplicate]
- Explode a paragraph into sentences in PHP
- How to limit the elements created by explode()
- Use of undefined constant STDIN – assumed ‘STDIN’ in C:\wamp\www\study\sayHello.php on line 5
- Trim leading white space with PHP?
- Split a string with two delimiters into two arrays (explode twice)
- Is there an equivalent in C++ of PHP’s explode() function? [duplicate]
- Can PHP PDO Statements accept the table or column name as parameter?
- How do you connect to multiple MySQL databases on a single webpage?
- Saving images in database mysql
- How do I retrieve the visitor’s ISP through PHP?