Source Code:
(back to article)
<?php $array = [" first ", " second ", " third "]; // Trim all elements in the array using the array_map() function // The trim() function is the callback function applied to each element $trimmed_array = array_map('trim', $array); print_r($trimmed_array); // Output: // Array ( [0] => first [1] => second [2] => third )
Result:
Report an issue