May 31, 2016

PHP array_filter trim is not working as callback

PHP array_filter trim is not working as callback

Have you tried this?

$arr = array_filter($arr, 'trim');

Solution:

$arr = array_filter(array_map('trim', $arr));


 

Last updated: May 31, 2016