cunoodle2 Posted June 29, 2009 Share Posted June 29, 2009 I have data that I need to store for a few different items. I WAS just going to use 0 for no and 1 for yes (same as true/false) but then I realized that I also have to have an "empty" or "Null" value. I can't just use 0,1 and NULL because I retrieve the intval() of the item and intval(NULL) returns 0. Is there a rule/set of numbers defined for empty,no,yes? I was going go use 0,1,2 respectively but wasn't sure if there was like a standard rule like true/false. Anyone have any input on this? Link to comment https://forums.phpfreaks.com/topic/164041-solved-0-is-false-1-is-true-what-about-yesnonull/ Share on other sites More sharing options...
Ken2k7 Posted June 29, 2009 Share Posted June 29, 2009 Let null be -1? Link to comment https://forums.phpfreaks.com/topic/164041-solved-0-is-false-1-is-true-what-about-yesnonull/#findComment-865350 Share on other sites More sharing options...
haku Posted June 29, 2009 Share Posted June 29, 2009 I agree. If there is TRUE, FALSE and one other option, I always use -1 for the other option. Link to comment https://forums.phpfreaks.com/topic/164041-solved-0-is-false-1-is-true-what-about-yesnonull/#findComment-865384 Share on other sites More sharing options...
cunoodle2 Posted June 29, 2009 Author Share Posted June 29, 2009 Ok cool. I'll follow those guidelines then. I just want to make sure I'm conforming by standard rules and wanted to have a dead set in stone set of rules for this project. Link to comment https://forums.phpfreaks.com/topic/164041-solved-0-is-false-1-is-true-what-about-yesnonull/#findComment-865412 Share on other sites More sharing options...
haku Posted June 30, 2009 Share Posted June 30, 2009 There unfortunately aren't a set of standard rules (or at least, I've never heard of one), rather there are just ways that most of us seem to do stuff, most of the time. But they are more unwritten rules than anything. Link to comment https://forums.phpfreaks.com/topic/164041-solved-0-is-false-1-is-true-what-about-yesnonull/#findComment-866090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.