Why we can't create object of another class as an element in php
<p>I seen some of the answers of the same questions in the forum.. but still the answers are not providing a clear idea..</p>

<p>In other languages like C# is executing fine. but why not PHP?</p>

<p>Check the example:</p>

<pre><code>class Student
{
    public $name;
    public $age;
    private $number;
}

class ss
{
    public $obj;
    public $objs=new Student();     //generating error

    public function act()
    {
        $obj = new Student();
        $obj-&gt;study();
        $obj-&gt;studentinfo();
    }
}

$ob = new ss();
$ob-&gt;act();
</code></pre>
