InterviewSolution
Saved Bookmarks
| 1. |
How to pass out of scope variables to a callback function? |
|
Answer» Here is the code snippet for reference. <?php $array = array (1, 3, 3, 8, 15); $my_val = 3; $filtered_data = array_filter($array, FUNCTION ($ELEMENT) use ($my_val) { return ($element != $my_val); } ); print_r($filtered_data); ?> |
|