Skip to content

Instantly share code, notes, and snippets.

@alexeydemin
Created March 1, 2017 01:06
Show Gist options
  • Save alexeydemin/c77443b8ec01cdb14f71263961af17bc to your computer and use it in GitHub Desktop.
Save alexeydemin/c77443b8ec01cdb14f71263961af17bc to your computer and use it in GitHub Desktop.
<?php
class MyClass {
public $id;
public $attribute;
public $value;
function __construct($i, $a, $v)
{
$this->id = $i;
$this->attribute = $a;
$this->value= $v;
}
function __toString()
{
$superRareString = '#~F50mgtlhOy~#';
return $this->attribute . $superRareString . $this->value;
}
}
$list = [new MyClass(1,1,2), new MyClass(2,1,5), new MyClass(3,1,8)];
function unique($array)
{
return array_unique( $array );
}
print_r( unique($list) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment