Hi,

first take a look at this page:
http://www.php.net/manual/en/function.substr.php

> if (substr($text, -1) == ".")

substr($text, -1) will return the last character in string $text.
if it is a "." the if statement will evaluate to true
and it'll do the following

> {$test = substr($text, 0, -1);}

$test = substr($text, 0, -1) will return all characters of $text but the
last one and write them
to $test.
a negative third parameter means ommitting characters from the end of the
string.
The end of the string depends on the second parameter, which tells us where
to start.
if it is positive, start is the start and end is the end of the string,
if it is negative start is the end and end is the start of the string

Regards Michael

P.S. the manual is your friend, learn how to read it!!!
"R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
000701c2015c$fd2e1570$0a6da8c0@lgwezec83s94bn">news:000701c2015c$fd2e1570$0a6da8c0@lgwezec83s94bn...

> Hi ppl,
> Can you tell me what does this mean?
>
> if (substr($text, -1) == ".")
> {$test = substr($text, 0, -1);}
>
> I know the if part searches the $text from the starting for the "."
> I am just confused about what the second and third arguement does in the
> substr. (Second line)
>
> I know that this is an easy question for you PHP guys out there,
>  and I know i will get an answer,
>  so I thank you all in advance.
>
> Cheers
> -Ryan A.
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to