Basic syntax question

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

Post Reply
letoii
Forum Newbie
Posts: 1
Joined: Tue Oct 27, 2009 12:41 pm

Basic syntax question

Post by letoii »

is there a shorter way to write this:

if (($curZip != '') && ($curFirst != '') && ($curLast != '')) {
}
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Basic syntax question

Post by requinix »

Not really, no.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Basic syntax question

Post by pickle »

You can take the parentheses off around the comparitors:

Code: Select all

if ($curZip != '' && $curFirst != ') && $curLast != '')
but as far as logic is concerned, that can't be compressed.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply