Technex Posted August 8, 2007 Share Posted August 8, 2007 Hey guys, please awnser as soon as you can if(empty($regusername|$regpassword|$regcpassword|$regemail|$regcemail)){ Parse error: syntax error, unexpected '|', expecting ')' in blah blah blah, what's the correct way of separating them preferably using | instead of & unless any other reasons why. Thanks very much! Quote Link to comment https://forums.phpfreaks.com/topic/63951-solved-just-a-quick-one-stupid-i-know-ifemptyregusernameregpassword-etc/ Share on other sites More sharing options...
lemmin Posted August 8, 2007 Share Posted August 8, 2007 I'm not sure what you are trying to do. empty() only accepts one argument. If you are trying to see if any of those variables are empty you need to have a separate comparison for each one. if(empty($regusername) || empty($regpassword) || empty($regcpassword) || empty($regemail) || empty($regcemail)){ If you are trying to test if all are empty, use &&. Quote Link to comment https://forums.phpfreaks.com/topic/63951-solved-just-a-quick-one-stupid-i-know-ifemptyregusernameregpassword-etc/#findComment-318767 Share on other sites More sharing options...
Orio Posted August 8, 2007 Share Posted August 8, 2007 Your syntax is very wrong. It should be: if(empty($regusername) || empty($regpassword) || empty($regcpassword) || empty($regemail) || empty($regcemail)){ Orio. Quote Link to comment https://forums.phpfreaks.com/topic/63951-solved-just-a-quick-one-stupid-i-know-ifemptyregusernameregpassword-etc/#findComment-318769 Share on other sites More sharing options...
Technex Posted August 8, 2007 Author Share Posted August 8, 2007 Works thanks, but is that good coding by using more than one? Would is_null be better in a performance comparison? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/63951-solved-just-a-quick-one-stupid-i-know-ifemptyregusernameregpassword-etc/#findComment-318774 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.