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
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Aug 03, 2004 1:01 pm
Hi All,
I was wondering if there's a simpler way to write this line:
I know it's pretty simple as it is, but I just can't stop thinking that there's a simpler way. Obfuscation is no object!!
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Lord Sauron
Forum Commoner
Posts: 85 Joined: Tue Apr 20, 2004 5:53 am
Location: Tilburg, NL
Post
by Lord Sauron » Wed Aug 25, 2004 6:47 am
???,
This must be about the shortest and most unclear question ever
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Wed Aug 25, 2004 9:41 am
I want to use fewer characters to do the same thing as:
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Aug 25, 2004 10:30 am
I don't think there is a fewer characters way.. really.. other than shortening the variable name.
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Wed Aug 25, 2004 10:35 am
LOL
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Wed Aug 25, 2004 11:55 am
Ok, I was just wondering. It was just nagging at me that it was more complicated than it needed to be. Ah well, thanks for putting my mind to rest
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Illusionist
Forum Regular
Posts: 903 Joined: Mon Jan 12, 2004 9:32 pm
Post
by Illusionist » Wed Aug 25, 2004 7:24 pm
how is it more complicated than it should be? what do you think it should be? Or how could it be easier? I think
Is pretty easy if you know that ! means not
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Aug 25, 2004 7:28 pm
problem is.. that's always false.
Illusionist
Forum Regular
Posts: 903 Joined: Mon Jan 12, 2004 9:32 pm
Post
by Illusionist » Wed Aug 25, 2004 8:53 pm
just as
would also always be false...
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Aug 25, 2004 9:16 pm
actually, no.. your's doesn't set.. only checks.. pickles sets to the negation.
Illusionist
Forum Regular
Posts: 903 Joined: Mon Jan 12, 2004 9:32 pm
Post
by Illusionist » Wed Aug 25, 2004 10:00 pm
ahh yes, i forgot, I was thinking of something different! haha my bad!
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Thu Aug 26, 2004 9:15 am
Well, you know how
Code: Select all
$var = $var + 1; /*can be written*/ $var++;
I was just thinking maybe there was a simple shortcut like
or something.
The question was meant more as a curious pipe dream than a problem I was dealing with. Thanks anyway folks.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.