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).
Your code is doing what you ask. You dont acces the private object $property. Instead you acces the public function show\_property() which resides inside the class simpleClass. So the object $property is still private. because both the function and the object are in the same class, the function can acces the object.

If you would try to echo the object from $my\_object, you would fail to do so because the object is private.