How to use OOPS In PHP
Basic Concept Of OOPS in PHP
How to use public or private variables and function from class in php
<?phpclass STUDENT{ public $name='xyz';
function cname() { echo $this->course='bca' ;}
}$stud= new STUDENT;
//$stud=new student //create objectecho $stud->name ;echo $stud->cname();
?>output is:
xyz bca
<?php
class STUDENT{
public $name='xyz';
function cname() {
echo $this->course='bca' ;
}
}
$stud= new STUDENT;
//$stud=new student //create object
echo $stud->name ;
echo $stud->cname();
?>
output is:
xyz bca
Comments
Post a Comment