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

One thought on “PHP array_filter trim is not working as callback

  1. Pingback: PHP array_filter trim is not working as callback - Website Designing Website Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s