Skip to content

How to trim white space array in PHP?

$fruit = array('  apple ','banana   ', ' , ',     '            cranberry ');
$trimmed_array = array_map('trim', $fruit);
print_r($trimmed_array);
See also  Python code snippet - How to store in parquet format using pandas?

Leave a Reply

Your email address will not be published. Required fields are marked *

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