Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12706

Re: include capturing wrong value

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Re: include capturing wrong value
Date 2014-01-23 18:50 +0100
Message-ID <52E15659.7080203@arnowelzel.de> (permalink)
References <18dy94v4tv51n.1f3ltkhc8door$.dlg@40tude.net> <lb3rqd$adc$1@dont-email.me> <4ch32eyxvwzd.o6ojwp3x5vt7$.dlg@40tude.net>

Show all headers | View raw


richard, 2014-01-14 18:50:

> On Tue, 14 Jan 2014 17:23:25 +0000 (UTC), Denis McMahon wrote:
> 
>> On Tue, 14 Jan 2014 11:56:16 -0500, richard wrote:
>>
>>> $go=$_GET['a'];
>>> if(empty($go)){$go=0;}
>>>
>>> if ($go>=60 and $go<=69) { include
>>> "http://mroldies.net/songs/19".$go.".html";}
>>> if ($go>="A" and $go<="Z") <<<<<<
[...]
>> You are not comparing the string "zero", you are comparing the number 0. 
>> You are only considering part of the test you are discussing in your 
>> above statements. You need to consider the whole test. The behaviour 
>> appears on inspection to be correct.
> 
> Point noted and understood.
> Still, "AND" is the key. not "OR".
> Both must be true to return true.
> Since 0 (zero as string) ls not greater than "A" the condition should
> return false.

But your comparison is not "greater than" - it is "greater or equal than":

if($go>="A" and $go<="Z")

if $go is 0 (and not "0"!) - then the condition perfectly matches - 0 is
greater or *equal* than 0 and also less or *equal* than 0.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

include capturing wrong value richard <noreply@example.com> - 2014-01-14 11:56 -0500
  Re: include capturing wrong value Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-14 17:23 +0000
    Re: include capturing wrong value richard <noreply@example.com> - 2014-01-14 12:50 -0500
      Re: include capturing wrong value Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-14 19:07 +0100
      Re: include capturing wrong value Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2014-01-14 10:10 -0800
      Re: include capturing wrong value Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-14 18:25 +0000
      Re: include capturing wrong value Arno Welzel <usenet@arnowelzel.de> - 2014-01-23 18:50 +0100
        Re: include capturing wrong value Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-23 18:05 +0000
          Re: include capturing wrong value "Peter H. Coffin" <hellsop@ninehells.com> - 2014-01-23 15:56 -0600
          Re: include capturing wrong value Arno Welzel <usenet@arnowelzel.de> - 2014-01-25 10:20 +0100
  Re: include capturing wrong value Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-01-14 21:20 +0000

csiph-web