Hi:
   sorry, the example is wrong , it should be :

    <?php
          if (strncmp(substr("num_suffix", -5, 5), "suffix", 5) == 0) {
               echo "they have the same suffix";
     }
    ?>

thanks

2011/8/14 Laruence <larue...@php.net>:
> Hi all internalers:
>    Since there comes some new objections,  I think I should open the
> RFC voteing again.
>
>    to Derick,  if I extended voting phase for two weeks ,  can we
> consider  this voteing valid?
>
>    I think this proposal is not explained clearly before, so I am
> going to explain it agian,
>
>    and I am not good at english,  so if I make you confused, sorry in advance.
>
>    -------
>
>    this RFC comes from a Featurn request: 
> https://bugs.php.net/bug.php?id=36944
>
>    when I saw the request,  I totally agree with the reporter,  and I
> think this feature can make sense for simplify following situation:
>
>    <?php
>           if (strncmp(substr("num_suffix", 0, -5), "suffix", 5) == 0) {
>                echo "they have the same suffix";
>      }
>
>     and you may wondering does negative length make sense?
>
>     yes,  because substr supports it already:
>
>     <?php
>         echo substr("test", 0, -1);
>
>     Now this RFC is  calling for vote again, plz read the RFC, and
> vote for it: https://wiki.php.net/rfc/strncmpnegativelen
>
>     if you have any question about this,  plz write back.
>
> thanks.
>
> 2011/8/14 Laruence <larue...@php.net>:
>> Hi:
>>  I think what I was done is try to describe a image, that we can make
>> follow codes more simple:
>>
>>  if (strncmp(substr("num_suffix", 0, -5), "suffix", 5) == 0) {
>>          echo "they have the same suffix";
>>  }
>>
>>  yes,  there is must something not good in my patch,  but I think I
>> can tweak it as you wish.
>>
>>  the only thing I want you to accept is : " should this behavior is
>> more make sense for some occassion?"
>>
>> thanks
>>
>> 2011/8/14 Laruence <larue...@php.net>:
>>> Hi:
>>>   this just to say that stncasecmp has the same behavior of either
>>> negative or postive length argument.
>>>
>>>   why you insist to this point?  as strncmp("aaaa", "bbb",  1000000)
>>> works with no warning,  why negative length need trigger warnings?
>>>
>>> thanks
>>>
>>> 2011/8/14 Derick Rethans <der...@php.net>:
>>>> On Sun, 14 Aug 2011, Ferenc Kovacs wrote:
>>>>
>>>>> On Sun, Aug 14, 2011 at 1:24 PM, Derick Rethans <der...@php.net> wrote:
>>>>> > On Sat, 13 Aug 2011, Laruence wrote:
>>>>> >
>>>>> >> Dear all:
>>>>> >>     I am going to close strn(case)cmp supporting negative length vote,
>>>>> >> since it has been calling for vote near two weeks, and no new feedback
>>>>> >> .
>>>>> >>
>>>>> >>     the Voting result is:
>>>>> >>      Support :  6  felipe pajoye pierrick gwynne tyrael laruence
>>>>> >>      Decline :  3  iliaa rasmus salathe
>>>>> >>
>>>>> >>     it wins 2/3 vote,   so I think this supposed to mean that accept,  
>>>>> >> right?
>>>>> >
>>>>> > I voted against too. Also, you started the vote with not even a week
>>>>> > between RFC announcement and call for voting, so I guess that makes this
>>>>> > invalid?
>>>>> >
>>>>> >
>>>>> > Just looked over the RFC, and this whole example is weird:
>>>>> >
>>>>> > <?php
>>>>> > var_dump(strncmp("prefix_num", "num", -10));
>>>>> > ?>
>>>>> >
>>>>> > Why does it even find the substring as you can't do "-10" from the end?
>>>>> > If the number is too high, it should give you a warning.
>>>>>
>>>>> imo the patch is consistent with how substr works:
>>>>> tyrael@thor:~$ php -d display_errors=1 -d error_reporting=-1 -r 'echo
>>>>> substr("prefix_num", -100);'
>>>>> prefix_num
>>>>
>>>> Maybe, but I would classify *that* as a bug as it makes no sense at all.
>>>>
>>>> Derick
>>>>
>>>> --
>>>> http://derickrethans.nl | http://xdebug.org
>>>> Like Xdebug? Consider a donation: http://xdebug.org/donate.php
>>>> twitter: @derickr and @xdebug
>>>
>>>
>>>
>>> --
>>> Laruence  Xinchen Hui
>>> http://www.laruence.com/
>>>
>>
>>
>>
>> --
>> Laruence  Xinchen Hui
>> http://www.laruence.com/
>>
>
>
>
> --
> Laruence  Xinchen Hui
> http://www.laruence.com/
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

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

Reply via email to