Thursday, 28 August 2014

PHP Array filter working code


Array filter does not allow duplicate values:

<?php
$array = array(1, "hello", 1, "world", "hello");

$new=array_filter(array_count_values($array),'custom_filter');

print_r($new);

function custom_filter($val)
{
  return $val > 1;
}

?>

No comments:

Post a Comment

Claude Code worflow

The Claude code task cycle 1. Gater context Reads files, explore projec structure, code base 2. Plan Break the task in to steps 3. Exe...