shadiadiph Posted May 16, 2009 Share Posted May 16, 2009 is there any simple way of working out how many true false combinations there could be in an array with 4 values? i think there are 16 but not sure?? or is it 12? Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/ Share on other sites More sharing options...
trq Posted May 16, 2009 Share Posted May 16, 2009 Sorry, your question makes little sense. Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835190 Share on other sites More sharing options...
Mark Baker Posted May 16, 2009 Share Posted May 16, 2009 An array with 4 elements, each of which can have one of 2 possible values (true/false) gives 2^4 combinations... that's 16. Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835192 Share on other sites More sharing options...
shadiadiph Posted May 16, 2009 Author Share Posted May 16, 2009 how can i find out how many true false values in combination of 4 for example 0 being false and 1 being true i think i have them all but am not sure is there another way of working this out? 0000 1000 1100 1110 1111 0111 0001 0011 1010 1001 1011 1101 I can only see 12 but maybe i am tired Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835194 Share on other sites More sharing options...
Daniel0 Posted May 16, 2009 Share Posted May 16, 2009 You can have these scenarios: S={(T,T,T,T), (T,T,T,F), (T,T,F,F), (T,F,F,F), (F,T,T,T), (F,F,T,T), (F,F,F,T), (F,F,F,F), (F,T,F,F), (F,F,T,F), (T,F,T,T), (T,T,F,T), (T,F,F,T), (T,F,T,F), (F,T,T,F), (F,T,F,T)} |S| = 16 Besides, what does this have to do with PHP, and why is it in PHP Help? Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835195 Share on other sites More sharing options...
shadiadiph Posted May 16, 2009 Author Share Posted May 16, 2009 thanks daniel thats great any chance you could please tell me how you worked that out? Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835196 Share on other sites More sharing options...
Daniel0 Posted May 16, 2009 Share Posted May 16, 2009 I just wrote down all different combinations. I knew there would be 42=16 different combinations, so I just kept on going until I had written down the 16th. Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835200 Share on other sites More sharing options...
shadiadiph Posted May 16, 2009 Author Share Posted May 16, 2009 thanks sorry i only asked because I thought you had done it from a piece of code Quote Link to comment https://forums.phpfreaks.com/topic/158369-solved-true-false-values/#findComment-835201 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.