class in php
Tuesday, November 18, 2008 9:32Class is nothing but binding the data. I’e variables and functions. In class we can have number functions. Class can be declare with a key word class followed by a class name, which can be any name. This name should not be key word in php. Followed by a pair of curly braces .
Its recommended to start class name with a capital letter. And functions with a small letter. Before class declarations we can use modifiers I’e public, abstract. If access modifier is nothing by default it will take defaultft modifier..
public class Demo{
$i=0;
function myfristfunction(){
$i++;
echo $i;
echo "this my first function ";
}
function mysecondfunctin(){
$i++;
echo $i;
echo "mysecond function";
}
}
output:
1 this my first function 2 mysecond function
class Second{
function mysecondclass(){
echo "this is my second class";
}
}
output:
this is my second class
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.

