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