Question: So I have a simple class that contains a property and a method. I don't understand why the private property of my class can be outputted outside of that class. Can anyone make some light on this? I read that it a private property can't be accessed outside of its class.

Why I don't get an error on the next code?

```php
class simpleClass{
    private $property = 'TEST';
        public function show_property(){
          echo $this->property;
        }
}

$my_object = new simpleClass();
$my_object->show_property();

```

Answer: 
The *property* may be private but you have also created a *public* function which has access to the property. This function `show_property()`, being part of the class itself, actually *has* access to the private parts of the class.

The comment you made shows a slight misunderstanding of the situation:

> 
> I don't understand why the private property of my class can be outputted outside of that class.
> 
> 
> 

You're right, it cannot be accessed outside of the class. It can only be accessed *within* the class. However, by calling `show_property()`, you have actually *moved* into the class (temporarily).
Make function as private.

```
class simpleClass{
    private $property = 'TEST';
        private function show_property(){
          echo $this->property;
        }
}

$my_object = new simpleClass();
$my_object->show_property();

```