Grow your CSS skills. Land your dream job.

Last updated on:

Perform Function on Each Item of an Array

array_map() takes two arguments. The first argument is the function to perform on the second argument (which is an array). Returns a new array.

$original = array('<p>Paragraph</p>', '<strong>Bold</strong>');
$new = array_map('strip_tags', $original);

// $new is now array('Paragraph', 'Bold');


  1. Permalink to comment#

    Nice one. Didn’t know about this function yet. Normally I would do a foreach loop.

Leave a Comment

Current day month ye@r *

*May or may not contain any actual "CSS" or "Tricks".