23 October 2019

This snippet shows you how to trim whitespaces from each array value in PHP. Expects all array values to be strings.

Source code viewer
  1. $my_array = array_map('trim', $my_array);
Programming Language: PHP