Skip to content

Instantly share code, notes, and snippets.

@mrcat323
Created January 30, 2017 15:27
Show Gist options
  • Save mrcat323/aeeac0c4356b591f02522df02b49b4e9 to your computer and use it in GitHub Desktop.
Save mrcat323/aeeac0c4356b591f02522df02b49b4e9 to your computer and use it in GitHub Desktop.
<?php
$arr = array(
0 => array("href" => "google.com", "text" => "Google"),
1 => array("href" => "ya.ru", "text" => "Yandex"),
2 => array("href" => "google.com", "text" => "Google RU"),
3 => array("href" => "google.com", "text" => "Google"),
);
$str = array();
$some = array();
foreach($arr as $key => $value) {
$some[$key] = $value["href"];
}
$some = array_unique($some);
foreach($some as $key => $value) {
$str[$key] = $arr[$key];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment