Created
March 1, 2017 01:06
-
-
Save alexeydemin/c77443b8ec01cdb14f71263961af17bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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