PHP array_map() FunctionLast Updated : 17 Mar 2025 The array_map( ) is an built-in function in PHP. The array_map( ) function sends each value of an array to a user-defined function, and returns an array with new values given by the user-defined function. This function was introduced in 4.0.6. SyntaxParameter
Return TypeThis function returns an array containing the values of array1, after applying the user-defined function to each one. EXAMPLE 1Output: Array ( [0] => sachin [1] => kapil [2] => dhoni ) EXAMPLE 2Output: Array ( [0] => unlike [1] => like [2] => unlike ) EXAMPLE 3Output: Array ( [0] => 1 [1] => 4 [2] => 9 [3] => 16 [4] => 25 [5] => 36 ) EXAMPLE 4Output: Array ( [0] => Array ( [0] => a [1] => 100 ) [1] => Array ( [0] => b [1] => 200 ) [2] => Array ( [0] => c [1] => 300 ) ) Next TopicPhp-array-merge-function |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India