Write a PHP script to trim all the elements in an array using array_walk function
- برمجة بي اتش بي
- 2021-09-09
- mhanasmh00489829403
الأجوبة
<?php
$colors = array( "Red ", " Green", "Black ", " White ");
print_r($colors);
array_walk($colors, create_function('&$val', '$val = trim($val);'));
print_r($colors);
?>
Sample Output:
Array
(
[0] => Red
[1] => Green
[2] => Black
[3] => White
)
Array
(
[0] => Red
[1] => Green
[2] => Black
[3] => White
)أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال