Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

define a Class with a Method

Sun Oct 26, 2008 11:31 pm

Code:
<html>
<head>
<title>A Class with a Method</title>
<body>
<?php
class first_class{
    var
$name;
    function
sayHello(){
        print
"hi";
    }
}

$obj1 = new first_class();
$obj1->sayHello();

?>
</body>
</html>




Post a reply
  Related Posts  to : define a Class with a Method
 Define class helper class to check the method existance     -  
 Define class inside another class C++     -  
 how to Define abstract class in php     -  
 Define your own exception class     -  
 define final class     -  
 Define getter and setter in php class     -  
 Define Enum inside a class     -  
 Define boolean Class properties     -  
 toString method in class php     -  
 invoke class method dynamically in php     -  

Topic Tags

PHP OOP