SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setup functions to recieve objects by reference when writing for PHP5?

    I know PHP5 automatically always sends objects as references to functions, unless you specifically use __clone(), however, I was wondering if I should still setup my functions to recieve objects as reference in PHP5, my code cannot be run in PHP4, so that's not an issue, I was just thinking, I'd prefer to write it that way for some reason, just to represent that the object does in fact get sent as a reference, and is worked with as a reference.

    I suppose I could just comment it, but using the reference method, I can prevent a straight cloned object from being passed with no return given.



    Any insight guys?
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Sounds like a PHP4 OOP addict to me

    I personally hated the syntax for passing by reference in PHP4 and avoided it at all cost. Therefore PHP5 is fantastic for me, but I can't see any reason that if you really wanted to, you couldn't continue using it.

    Can't hurt anything I suppose.

  3. #3
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, that's about what I figured.

    (/me = not PHP4 OOP addict )
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •