Skip to content

Instantly share code, notes, and snippets.

@stol
Created December 19, 2013 09:27
Show Gist options
  • Save stol/8036665 to your computer and use it in GitHub Desktop.
Save stol/8036665 to your computer and use it in GitHub Desktop.
<?php
$list = array(
array(
'foo' => 'caca'
),
array(
'foo' => 'prout'
),
array(
'foo' => 'caca'
),
array(
'foo' => 'prout'
)
);
$newTab = array();
foreach ($list as $item) isset($newTab[$item['foo']]) OR $newTab[$item['foo']] = $item['foo'];
print_r($newTab);
// => Array ( [caca] => caca [prout] => prout )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment