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));

PHP array_filter trim is not working as callback

Advertisements