Basic Object Accessing

<?php
    class myPHP4Class {
        var $my_variable;
        function my_method($param) {
            echo "my_method($param)!\n";
            echo "my variable is: ";
            echo "{$this->my_variable}\n";
        }
    }     $myinstance = new myPHP4Class();
     $anotherinstance = new myPHP4class();
     $myinstance->my_variable = 10;
     $anotherinstance->my_variable = 20;
     $myinstance->my_method("MyParam");
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.