Re: Re: comparing strings - again!

From: Date: Tue, 20 Jun 2006 15:54:47 +0000
Subject: Re: Re: comparing strings - again!
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-238411@lists.php.net to get a copy of this message
Jochem Maas wrote:
ross@aztechost.com wrote:
var_dump gives Company Director string(17) Company Director string(16) Why would they be different?
probably because there is either: 1. white space in the value in your data source 2. white space being outputted along side the value when creating a form field weith that valu that and/or possible the fact that your doing a trim() in one place but not in another - personally I usually trim() incoming string data (regardless of any other validation/sanitation) to avoid stuff like this
Seems like they have add some extra whitespace?
exactly. btw: var_dump() should be showing exactly where the white space is e.g.: code: <?php $s1 = "Company Director "; $s2 = "Company Director"; var_dump($s1, $s2); output: string(17) "Company Director " string(16) "Company Director"
Without the quotes he's not going to see the extra white space though, as the browser is going to render the first space it comes too, but it will piss on any white space after that (for display purpose). Main reason I wrap my debugging data in <pre></pre>. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#238411) next »