>>>>> "NT" == Nathan Torkington <[EMAIL PROTECTED]> writes:

NT> Chaim Frenkel writes:
>> Somehow I find
>> if (40 == ($foo = substr($bar, index($bar, 'xyz')))) {
>> }

NT> I don't understand your hypothetical code.  substr() returns the
NT> substring of $bar from the position retutned by index, onward.
NT> When would this be 40, if index is going to return the position
NT> of 'xyz'?

NT> I guess I can't understand your idea of safe failure until I
NT> see an example, and this doesn't seem to be it.

Whoops, I was tired.

        $to = "010 020 030 047";
        $from="AAA BBB CCC DDD";

        print substr($to,index($from,"BBB"),3);
        print substr($to,index($from,"XXX"),3);
        __END__
        020
        7

I would like to have an undef returned.

(Now it would have been interesting if it returned "047", then having
index return an undef and then having substr() propgate the undef
would make things workable.)

If you are familiar with Sybase's version of sql. Invalid arguments
to various functions return NULL.

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to