Php oop!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Php oop!

    can any one give a firm details about whats the difference between normal php and php oop!! what is extra in object oriented programming!! please let me know. I came here as i googled this and not getting the whole thing.

    #2
    Originally posted by asifnayem View Post
    can any one give a firm details about whats the difference between normal php and php oop!! what is extra in object oriented programming!! please let me know. I came here as i googled this and not getting the whole thing.
    Here an simple description of what php oop can' do .. i can't tell you more because i'm still learning on that :D

    So . php oop its gonna make your codding very,very light and easy to manage .. because an php oop class can be used on manny scripts on different tasks is adaptable so for example to make an ease off ussage you could use it verry simple such as

    PHP Code:
    <?php 

    $myoop
    = new oopclass();
    $myoop->task('commands here','and something else');

     
    ?>
    While you gonna still learning you gonna think that its more like some' simple functions defined , but believe me that its more than just a simple function because an' oop class can use lot of functions defined in his content , as you can see in the upper example $myoop->task is a called function so you can execute a whole script just with 3 - 4 lines as simple as that :p

    So go for OOP ...

    Object Oriented PHP Tutorial for Beginners - KillerPHP.com

    here is a beginner tutorial for you enjoy reading it !


    Cheers !
    This is ten percent luck, twenty percent skill
    Fifteen percent concentrated power of will
    Five percent pleasure, fifty percent pain

    And a hundred percent reason to remember the name!

    Comment


      #3
      For large applications, PHP OOP is good but for small applications PHP OOP is bad
      tinyurl.com/earnbymobile
      Easy earning for Indians
      ---------------------
      Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android
      goo.gl/6vub3

      Comment


        #4
        Any1 of u Can Tell me
        that is dis right way to access functions in class
        Code:
        class mycls {
        public function me(){
        return "Hi";
        }
        public function hehe(){
        echo $this->me();
        }
        }
        or this
        Code:
        class mycls {
        public function me(){
        return "Hi";
        }
        public function hehe(){
        echo me();
        }
        }
        nd what is use of $this

        Comment


          #5
          1st one is correct

          $this represents the object inside the class
          PHP Code:
          class mycls {
          public 
          $name;
          public function 
          me()
          {
          return 
          "Hi";
          }
          public function 
          hehe()
          {
          //inside the class
          echo $this->me(); 
          }
          }
          $object = new mycls;
          echo 
          $object->me();
          //look at the above code, you had to create an instance of the class but inside the class you can use $this :P :D 
          I need some facebook likes, can you please help me
          http://facebook.com/softwarefreakin
          I noticed social media is really powerful
          Well DONE is better than well SAID

          Comment


            #6
            Originally posted by softwarefreak View Post
            1st one is correct

            $this represents the object inside the class
            PHP Code:
            class mycls {
            public 
            $name;
            public function 
            me()
            {
            return 
            "Hi";
            }
            public function 
            hehe()
            {
            //inside the class
            echo $this->me(); 
            }
            }
            $object = new mycls;
            echo 
            $object->me();
            //look at the above code, you had to create an instance of the class but inside the class you can use $this :P :D 
            :P i know had to create an instance make it wrk

            Comment


              #7
              Originally posted by shushant View Post
              :P i know had to create an instance make it wrk
              I know dat, you know but I tried to show the use of $this
              oreilly OOP e-book for a clear understanding, it's very helpful
              I need some facebook likes, can you please help me
              http://facebook.com/softwarefreakin
              I noticed social media is really powerful
              Well DONE is better than well SAID

              Comment


                #8
                Originally posted by softwarefreak View Post
                I know dat, you know but I tried to show the use of $this
                oreilly OOP e-book for a clear understanding, it's very helpful
                Don't take me as wrng i was in need of help In OOP :p Having Problem understaning The use of $this and Some other Variables

                Comment


                  #9
                  OOP can be a force for both good and evil. Evil if you don't know what you're doing.

                  Comment


                    #10
                    $this

                    Originally posted by softwarefreak View Post
                    1st one is correct

                    $this represents the object inside the class
                    PHP Code:
                    class mycls {
                    public 
                    $name;
                    public function 
                    me()
                    {
                    return 
                    "Hi";
                    }
                    public function 
                    hehe()
                    {
                    //inside the class
                    echo $this->me(); 
                    }
                    }
                    $object = new mycls;
                    echo 
                    $object->me();
                    //look at the above code, you had to create an instance of the class but inside the class you can use $this :P :D 


                    i think "$this" represent non-static call , don't get me wrong, I'm an noob willing to learn :P

                    Comment


                      #11
                      Originally posted by StunningNick View Post
                      i think "$this" represent non-static call , don't get me wrong, I'm an noob willing to learn :P
                      Ok master, got it :D

                      added after couple of minutes :D (just phped php.net for perfect answer)

                      $this is a reference to the calling object (usually the object to which the method belongs, but possibly another object
                      Last edited by softwarefreak; 18.03.12, 19:19.
                      I need some facebook likes, can you please help me
                      http://facebook.com/softwarefreakin
                      I noticed social media is really powerful
                      Well DONE is better than well SAID

                      Comment


                        #12
                        this

                        Originally posted by softwarefreak View Post
                        $this represents the object inside the class
                        i think "$this" represent non-static call , don't get me wrong, I'm an noob willing to learn :P
                        none of us is wrong technically/programatically...

                        "this" represent an non-static call to an object/method/variable bla bla bla etc... thanks for correction Dude :cheers:

                        Comment


                          #13
                          im a noob at oop ..... how do you call for a function within a function within the same class ?

                          Comment


                            #14
                            Originally posted by something else View Post
                            im a noob at oop ..... how do you call for a function within a function within the same class ?
                            Not oop: function_name();

                            Oop: $this->function_name();
                            Advertise your mobile site for FREE with AdTwirl

                            Comment


                              #15
                              I mean if i have got a class like:
                              PHP Code:
                              <? 
                              class someclass{

                              funtion function1(){
                               //do something here
                              }

                              funtion function2(){
                                //how do i use function1 here?
                              // $someclass->function1();  //tried this and it caused errors
                              // or is it $this->function1(); //i havent tried using this
                              }

                              }
                              ?>

                              Comment

                              Working...
                              X