November 10, 2014

Use of array_map Function in Real Time ?

It will apply for many things. For example want to do php function for set of elements will use that
Example

If have like below

$first_name = trim($_POST['firstname']);


$lastname = trim($_POST['lastname']);

but instead of above

$_POST = array_map("trim", $_POST);


$array = array_map("trim", $array);


It will remove the spaces for the set of elements.



No comments:

Post a Comment