PHP Tutorial Tutorials - PHP Objects

PHP Objects

An object is a specific instance of a class.
Every object instance is completely independent and has properties and methods.
Objects are also known as instance.

To create a new object, use the new statement to instantiate a class:

<?php
class foo
{
    function show()
    {
        echo "This is the show method"; 
    }
}

$bar = new foo;
//$bar->show();
var_dump($bar);
?> 

Output:

object(foo)#1 (0) {
}
Date:2019-10-01 01:02:06 From:www.Lautturi.com author:Lautturi