FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Beginner's trouble with substr
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Beginner's trouble with substr [message #179461 is a reply to message #179457] Tue, 30 October 2012 05:18 Go to previous messageGo to previous message
C is currently offline  C
Messages: 24
Registered: January 2012
Karma:
Junior Member
On 29 loka, 21:46, Salvatore <s...@yojimbo.hack.invalid> wrote:
> On 2012-10-29, C <wrong.addres...@gmail.com> wrote:
>
>> I took that code out which defines $found. The code is trying to avoid
>> some nasty visitors.
>
> Ah, okay. I tried all the substr() calls and they appear to work properly.
> However, the second substr() call is taking the last six characters off
> the end of the string "$host", and not the first six characters as I
> imagine you are trying to do.

Yes, that is my mistake. Thanks.

>
> Here's some sample code I put together to test this:
>
> <?php
> $host = 'a1b2c3d4e5f6';
> $sub = substr($host, 6);
> print "$sub\n";
> ?>
>
> The above code results in the string "d4e5f6" being printed out, and not
> "a1b2c3" as you may expect. If you want only the first six characters,
> set the second parameter to 0 (zero) and the third parameter to 6.
>
> --
> Blah blah bleh...
> GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Requesting Help with a Regular Expression
Next Topic: skipping question "Do you want to save or open the file"
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 16:05:42 GMT 2024

Total time taken to generate the page: 0.04732 seconds