Skip to content

How to trim white space array in PHP?

$fruit = array('  apple ','banana   ', ' , ',     '            cranberry ');
$trimmed_array = array_map('trim', $fruit);
See also  How to append a number to a list in Python?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.