how can I ignore all the duplicating records and get only those which do not have a tie in mysql for example; from the following data set;

```
1|item1| data1
2|item1| data2
3|item2| data3
4|item3| data4

```

I want to get this get this kind of results;

```
3|item2| data3
4|item3| data4

```
['https://Stackoverflow.com/questions/41073364', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6870393/']
before call third function you need to call first two functions that will assign values to $this->a & $this->b

try below code :

```
protected $a;
protected $b;

function fast()
{   
    $a=10;
    $this->a = $a;
}
function slow()
{ 
    $b=20;
    $this->b = $b;
}
function avg()
{
    $c=$this->a+$this->b;
    echo $c;
}

}
$relay = new race();
$relay->fast();
$relay->slow();
$relay->avg();

```
Firstly, you are using object properties incorrectly. You need to first specify the scope of the property; in this case, I used protected scopes so you can extend the class as and when you need to use the properties directly.

Also, note if you're trying to add an **unset** variable, it will not work, you can either add this instance to your `__construct()` or set them to equal to 0 in the property instance.

```
class Speed {

    protected $_a = 0;
    protected $_b = 0;

    public function fast()
    {
        $this->_a = 20;
        return $this;
    }

    public function slow()
    {
        $this->_b = 10;
        return $this;
    }

    public function avg()
    {
        return $this->_a + $this->_b;
    }

}

```

This can then be used like this:

```
$s = new Speed();
$s->fast()->slow();

// todo: add logic

echo $s->avg();

```

---

**Update:**

Just side note, try **not** to output directly to a view in a method closure. Use templates, return the values from your methods and output them to a template.