On Fri, Apr 22, 2011 at 10:27:33AM -0400, Matt Pelmear wrote:

> My questions are:
> 1) What is the advantage to converting both strings to ints to compare them?

It makes things easy for working on what comes back from a form (in $_POST/...).
It is a nice feature, and works well *most* of the time.

I do wish that the Perl way of doing it had been used, ie:
        ==      numeric compare
        eq      text compare
It solves many problems at the cost of a little more developer clue.

I suppose that the proper way is to use as you say:
        if( (string) $a === (string) $b ) .....

or strcmp()

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to