Trim all array elements (PHP)

Trim all array elements with PHP:

$trimmed_array = array_map('trim', $fruits);


To see the difference:

 

$fruits = [' apple ', 'orange ', ' mango', 'kiwi' ];

$trimmed_array = array_map('trim', $fruits);

echo " <pre>";
print_r( $trimmed_array );
print_r( $fruits );

 

Neuen Kommentar schreiben

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Suche

Neueste Kommentare