Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
Is there any efficieny difference between these 2 examples. I have been using method 1 but would rather use the second. If there is no difference what would be recommended?
1:
If there is any difference at all, it wouldn't be noticeable. Slow-downs that are results of trivial things like this are only apparent when you have a huge application, so I wouldn't worry about it.
As far as which one is recommended, the second option looks like it's more organized, but it's hard to say, without knowing what exactly you're doing with this code.
Answer: neither, most efficient (and also readable) would be use no variable at all.
But yeah the real answer is it doesn't matter. Don't worry about saving 1ms of variable time when you are going to have 500ms database queries later on!