Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-16 Thread Jochem Maas
Jason Pruim schreef: > > On Oct 15, 2008, at 7:18 AM, Nathan Rixham wrote: > >> Jason Pruim wrote: >>> I probably should have mentioned that this was in a function to do >>> the heavy lifting for authentication :) I just didn't paste the whole >>> function since 90% of it worked just fine :) >>>

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-15 Thread Jason Pruim
On Oct 15, 2008, at 7:18 AM, Nathan Rixham wrote: Jason Pruim wrote: I probably should have mentioned that this was in a function to do the heavy lifting for authentication :) I just didn't paste the whole function since 90% of it worked just fine :) Now I just need to get better and separ

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-15 Thread Nathan Rixham
Jason Pruim wrote: I probably should have mentioned that this was in a function to do the heavy lifting for authentication :) I just didn't paste the whole function since 90% of it worked just fine :) Now I just need to get better and separating presentation and code :) very smiley today

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-15 Thread Jason Pruim
On Oct 14, 2008, at 7:24 PM, Jochem Maas wrote: Colin Guthrie schreef: Jochem Maas wrote: Jason Pruim schreef: if(isset($_SESSION['userInfo']['loggedin']) && $_SESSION['userInfo']['loggedin'] == TRUE) { Or, seeing as I'm a stickler for compact code: me too, I also like to be able to chan

[PHP] Re: 1 last error to fix before the application is done!

2008-10-15 Thread Colin Guthrie
Jochem Maas wrote: Colin Guthrie schreef: if(!empty($_SESSION['userInfo']['loggedin'])) { if (Sess::userLoggedIn()) { /* ... :-) */ } Well, yes, that's how I do it in my apps too, but in internally in that function you may want to use the empty() call :) I agree that when checking for

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Jochem Maas
Colin Guthrie schreef: > Jochem Maas wrote: >> Jason Pruim schreef: >>> Good morning everyone! >>> >>> I think I might be having a "to early in the morning/not enough >>> caffeine" moment... But I am down to 1 error on my timecard application >>> that I would like to clean up. It's a small undefine

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Yeti
Ok, so empty is faster. I appreciate the time you guys took to bench the thing. But I'm still gonna use array_key_exists. If you like it or not. Using it a couple of times in my scripts will slow them down a few nanoseconds. That's plain evil mwhahaha. //A yeti -- PHP General Mailing List (http:

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Jason Pruim
On Oct 14, 2008, at 11:05 AM, Wolf wrote: Does the ! reverse the empty in this case? such as !empty = not empty? You definitely have to go walk the plank now... You have to go back and re-write code and make it more compact now, right? tsk, tsk. I thought we taught you better then

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Wolf
> Does the ! reverse the empty in this case? such as !empty = not empty? You definitely have to go walk the plank now... You have to go back and re-write code and make it more compact now, right? tsk, tsk. I thought we taught you better then that. ! is the NOT operator in many languages. So

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 10:29 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote: > Andrew Ballard wrote: >> >> I've heard that a lot, but I just don't see it. I'm sure some of you >> can come up with better tests than this, but here is what I used: > > ... >> >> Based on these results, I'd hardly use the

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie
Andrew Ballard wrote: I've heard that a lot, but I just don't see it. I'm sure some of you can come up with better tests than this, but here is what I used: ... Based on these results, I'd hardly use the "language construct versus function call" optimization argument to make my decision. I'm n

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie
Yeti wrote: Personally, I very rarely see the point in using array_key_exists... It's a function call and has overhead where as isset() and empty() are language constructs and (I would hope) are much more efficient (although I've not done any benchmarks) # i don't know what's wrong with this

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 8:52 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote: > Yeti wrote: >> >> You might also want to try array_key_exists >> >> if (array_key_exists('loggedin', $_SESSION['userInfo'])) { >> // do something with $_SESSION['userInfo']['loggedin'] >> } > > You'd first need to check tha

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Yeti
> Personally, I very rarely see the point in using array_key_exists... It's a > function call and has overhead where as isset() and empty() are language > constructs and (I would hope) are much more efficient (although I've not done > any benchmarks) # i don't know what's wrong with this .. $f

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie
Peter Ford wrote: You can probably short-circuit some of that - for example if $_SESSION['userInfo']['loggedIn'] is only ever set to TRUE (and is not set otherwise) then you might find that if (isset($_SESSION['userInfo']['loggedin'])) { As I mentioned elsewhere on this thread, !empty(..) is a

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie
Jason Pruim wrote: Or, seeing as I'm a stickler for compact code: if(!empty($_SESSION['userInfo']['loggedin'])) { empty() is like isset() but tests for all sorts of "empty" cases ('', false, null and 0 are all considered, "empty"). Hey Colin, Does the ! reverse the empty in this case? such

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie
Yeti wrote: You might also want to try array_key_exists if (array_key_exists('loggedin', $_SESSION['userInfo'])) { // do something with $_SESSION['userInfo']['loggedin'] } You'd first need to check that the key 'userInfo' existed in the $_SESSION array too. Personally, I very rarely see the

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Peter Ford
Jason Pruim wrote: > Good morning everyone! > > I think I might be having a "to early in the morning/not enough > caffeine" moment... But I am down to 1 error on my timecard application > that I would like to clean up. It's a small undefined index error, and > the program works jsut fine the way i

Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Jason Pruim
On Oct 14, 2008, at 8:38 AM, Colin Guthrie wrote: Jochem Maas wrote: Jason Pruim schreef: Good morning everyone! I think I might be having a "to early in the morning/not enough caffeine" moment... But I am down to 1 error on my timecard application that I would like to clean up. It's a sma

[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie
Jochem Maas wrote: Jason Pruim schreef: Good morning everyone! I think I might be having a "to early in the morning/not enough caffeine" moment... But I am down to 1 error on my timecard application that I would like to clean up. It's a small undefined index error, and the program works jsut fi