FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » using same variable twice on same page
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: OT: Assignment operator (Was: using same variable twice on same page) [message #171621 is a reply to message #171353] Wed, 12 January 2011 15:50 Go to previous messageGo to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma:
Senior Member
On 12/30/2010 1:36 PM, Jim Higgins wrote:
> On Thu, 30 Dec 2010 15:35:10 +0100, August Karlstrom
> <fusionfile(at)gmail(dot)com> wrote:
>
>> On 2010-12-30 05:47, Jerry Stuckle wrote:
>>> On 12/29/2010 8:07 PM, August Karlstrom wrote:
>>>> On 2010-12-29 11:42, Derek Turner wrote:
>>>> > On Tue, 28 Dec 2010 22:07:55 -0700, richard wrote:
>>>> >
>>>> >> <?php if ($year="1961")
>>>> >
>>>> > This simply sets $year to "1961" and will always return 'true'
>>>>
>>>> ...which is more or less a flaw in the language design copied from C.
>>>
>>> Not at all. == is a completely different operator than =. Just like ++
>>> is not the same as +.
>>
>> The equal sign `=' has been used in mathematics since medieval times to
>> denote equality. To use `==' for equality and `=' for something else
>> (assignment) is not sensible.
>
>
> All fine and dandy if you're programming in BASIC, but when
> programming in PHP you'll either do it as PHP requires or you'll not
> get the result you expect. Sensible or not that's the way it is. Your
> choice.

Now hand him what "===" means :-)

I just stepped in from and haven't read the history of this thread.
However, just from this little bit I can see that he doesn't know
programming at all. I'll bet he even thinks that

$a = 11;

means that the variable $a is equal to 11 and that this is an equation.
(Hint August: It isn't an equation. It is an expression that you are
taking the value 11 and setting the value of 11 into to the memory
location denoted by the variable $a).

Programming != mathematics.

Anyway, perhaps August should pick up a book on C, C++, Java and see
what they use for tests of equality before he criticizes PHP.

--
Shelly
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: AND in the if statement
Next Topic: login script using file, not mysql
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 00:58:31 GMT 2024

Total time taken to generate the page: 0.07340 seconds