To create a class we need to use a class keyword.
Example
class Phpinterview{
}
}
?>
The above created a class named Phpinterview.
To add a method to a class follow this
class Phpinterview{
function questions{
echo 'php questions';
}
function answers{
echo 'Answers for the questions';
}
}
}
?>
Here you have created two methods questions and answers for the class Phpinterview
No comments:
Post a Comment