Object in PHP


Object


When you refer to variables belonging to these objects as properties (or attributes or fields),
and functions are called methods. These objectsare essential when dealing with PHP, as
almost everything is an object: for example, functions or arrays are objects, too!


Ex:
<?php
class foo
{
function do_foo()
{
echo "J Section students always rocks!.";
}
}
$bar = new foo;
$bar->do_foo();
?>


Output: J Section Students Always Rocks!.

Custom Search

%d bloggers like this: