In this tutorial learn how to use object based class in php, Class is a programmer-defined data type, which includes local methods and local variables.
Tutorial 1 : Create a function in the class using index
Create a object to call class and its functions.
<?php
class Category
{
}
?>
Tutorial 1 : Create a function in the class using index
class Category
{
public function index()
{
echo "This is object based class.";
}
}
Create a object to call class and its functions.
$obj = new Category;
echo $obj->index();
Complete Tutorial
<?php
/*
*
*/
// Create a new object
$obj = new Category;
echo $obj->index();
class Category
{
public function index()
{
echo "This is object based class.";
}
}
?>
No comments:
Post a Comment