-1 is the index of the char number you want to examine.
http://www.php.net/manual/en/function.substr.php

So that code is checking the last char of the string
to see if its ".", if it is, it returns everything *except*
the ".".

Please consult the online manual in the future... 
it wants to be your friend.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: r [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 22, 2002 2:51 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] substr....what does this mean? (newbie)
> 
> 
> 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
> 

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

Reply via email to