<?php $array = array( array( 'type' => 'checkbox', 'id' => 'f0', 'is_active' => 1 ), array( 'type' => 'checkbox', 'id' => 'f1', 'is_active' => 0 ), array( 'type' => 'radio', 'id' => 'f2', 'is_active' => 0 ), array( 'type' => 'checkbox', 'id' => 'f3', 'is_active' => 1 ), array( 'type' => 'text', 'id' => 'f4', 'is_active' => 1 ) ); $filtered = array_reduce($array, function($a,$b){ if($b['type'] == 'checkbox' && $b['is_active'] == 1){ $a[] = $b; return $a; }else{ return $a; }},[]); print_r($filtered);
You have javascript disabled. You will not be able to edit any code.