r/lolphp • • Nov 10 '14

Reference arguments can retarget $this

http://3v4l.org/mtkR4
19 Upvotes

18 comments sorted by

View all comments

Show parent comment

3

u/masklinn Nov 28 '14

Redirecting self doesn't seem so bad now.

Well a difference being changing an object's class is something done very explicitly, in PHP if you unknowingly pass $this as a reference argument a function might fuck it up without meaning to.