Xurion Posted June 17, 2008 Share Posted June 17, 2008 Hi all, I'm having a debate over some standards that my employer wants to put in place for PHP coding. He has said we should use: if((condition) and (condition)){ rather than: if((condition) && (condition)){ His reason for this is because we use && in JavaScript. I've not seen anyone using the 'and' in if statements in forever. Is it depreciated? or is using it totally ok? Are there any differences comparing 'and' to &&? Thanks in adv. Quote Link to comment https://forums.phpfreaks.com/topic/110592-depreciated-code/ Share on other sites More sharing options...
conker87 Posted June 17, 2008 Share Posted June 17, 2008 AND and && are exactly the same. && is better IMHO because it separates words (i.e. comparing variables.) Quote Link to comment https://forums.phpfreaks.com/topic/110592-depreciated-code/#findComment-567359 Share on other sites More sharing options...
KevinM1 Posted June 17, 2008 Share Posted June 17, 2008 Hi all, I'm having a debate over some standards that my employer wants to put in place for PHP coding. He has said we should use: if((condition) and (condition)){ rather than: if((condition) && (condition)){ His reason for this is because we use && in JavaScript. I've not seen anyone using the 'and' in if statements in forever. Is it depreciated? or is using it totally ok? Are there any differences comparing 'and' to &&? Thanks in adv. What does it matter that you use '&&' in JavaScript? Virtually all C-style code uses '&&' as logical AND. I fail to see any gain this proposed switch would give. Indeed, I think it would look awkaward, and perhaps even confusing. Quote Link to comment https://forums.phpfreaks.com/topic/110592-depreciated-code/#findComment-567390 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.