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
kettle_drum
DevNet Resident
Posts: 1150 Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England
Post
by kettle_drum » Sun Nov 14, 2004 4:04 am
Dont know if im just not seeing it, but is there a function to turn a possitive number into a negative? E.g. 12 will become -12 or do we just have to subtract the value from itself twice?
djot
Forum Contributor
Posts: 313 Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:
Post
by djot » Sun Nov 14, 2004 4:44 am
-
Hi,
I don't know any. But your idea to substract the value twice from itself was funny to me
Why not just multiply with -1 ?
djot
-
kettle_drum
DevNet Resident
Posts: 1150 Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England
Post
by kettle_drum » Sun Nov 14, 2004 4:46 am
Hmm interesting...lol. That might be a better idea
Code: Select all
$value *= -1;
not
$value -= ($value*2);
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Nov 14, 2004 8:57 am
kettle_drum wrote: Hmm interesting...lol. That might be a better idea
Code: Select all
$value *= -1;
not
$value -= ($value*2);
Sometimes the obvious is the unobvious.. if that makes sense
patrikG
DevNet Master
Posts: 4235 Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK
Post
by patrikG » Sun Nov 14, 2004 9:19 am
Phenom wrote: Sometimes the obvious is the unobvious.. if that makes sense
Like known knowns and known unkonwns and unknown knowns and unknown unknowns.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Nov 14, 2004 9:29 am
But the unknown is known unless the known is known and unknown not known while the unknown is unknown
patrikG
DevNet Master
Posts: 4235 Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK
Post
by patrikG » Sun Nov 14, 2004 9:33 am
The unkown will remain unknown unless known.
(that's it from me - don't want to derail this thread further
)