Form code with honey pot not working?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Form code with honey pot not working?

Post by John Cartwright »

mmj wrote:I agree but empty is just as much as surpressor as @ and has no "semantics".
[/quote]
mmj wrote:
Jcart wrote:Actually empty() provides the added benefit of checking the variable has a (positive) value, so that is incorrect.
:?:

...
So you call not generating notices having no semantics? The @ error supressor temporarily sets the error reporting to 0, however empty() properly checks for the existance of the variable. I think it's pretty obvious which one lacks "semantics".
mmj
Forum Contributor
Posts: 118
Joined: Fri Oct 31, 2008 4:00 pm

Re: Form code with honey pot not working?

Post by mmj »

Jcart wrote:However, calling empty() an error supressor simply isn't right. It's purpose is not to supress errors.
It's purpose is to check variables without throwing an error even if the variable or array key doesn't exist.

If you'd want to reimplement it you'd have to use error suppression (not saying that the PHP core does that).

Which means:

I would use

Code: Select all

(bool)$var
except I get an error if it isn't set.

So how do I suppress this error and yet get the same result?

Use empty!

So what is the real reason I'm using empty?

To suppress errors!

Is that so hard to understand? :banghead:
Jcart wrote:The @ error supressor temporarily sets the error reporting to 0, however empty() properly checks for the existance of the variable. I think it's pretty obvious which one lacks "semantics".
I wasn't comparing empty to @.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Form code with honey pot not working?

Post by John Cartwright »

empty() does not supress anything as it does not generate any errors.

Is that so hard to understand?

I'm confused by this whole topic now.
Post Reply