<?php
class ser {
public $a;
}
$x = new ser;
$x->b = 10;
var_dump($x);
Something like this.
Class ser has only $a property, but we can set $b to new object of this class and it works despite this class doesn't have any $b property
output
E:\XAMPP\htdocs\fun\test2.php:12:
object(kurde)[1]
public 'a' => null
public 'b' => int 10
Why this works?
Why we can add property and set it to this class while it doesn't belong exactly to this class?
How is that possible and why is that possible?
Any purpose? Sense of making this possible?