Create Class and Object In PHP simple Example
<?php
class class1 { // create class
function myname(){ // create function
echo 'my name is Rajeev Dhar Dwivedi' ;
}
function addvalue($a, $b){ // create another function
echo $a+$b;
}
};
?>
<?php
$a = new class1(); // create object here
$a->myname(); // call myname() function here
echo '<br>';
$a->addvalue(5,10); // call addvalue() function here
?>
OUTPUT :
my name is Rajeev Dhar Dwivedi
15
very good example to understand
ReplyDelete