Thursday, 24 October 2013

Tutorial 4 : Array List implementation in PHP (Creation of DTO Class)

Dear Techie's,
                     I have shared basic resources of application in Tutorial 1 To 3. Those files are used to db connection , processing Array List etc. In this post i will do actual Array List implementation.

In java, most of java programmers use setter and getter methods to setting an getting a values. the class contains many setter getters for their values. and these methods wrapped inside a class. in  java ,for these classes we call 'DTO class'(Data Transfer Object) . In PHP, setter getter functionality is similar to java DTO class. 

Let's do practice,



user_id = $id;
    }

    // getter method : this method only returns the private variable value.        
    function get_user_id() {
        //returns a value of private variable $user_id

        return $this->user_id;
    }

    //same type of getter setter methos for variable $user_name.

    function set_user_name($name) {

        $this->user_name = $name;
    }

    function get_user_name() {

        return $this->user_name;
    }

}?>

0 comments:

Post a Comment