RE: [PHP] substr....what does this mean? (newbie)
| From: | Scott Hurring | Date: | Tue, 21 May 2002 18:08:38 +0000 |
| Subject: | RE: [PHP] substr....what does this mean? (newbie) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-98623@lists.php.net to get a copy of this message | ||
-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
ScottH@eac.com
Voice: 201-462-2149
Fax: 201-288-1515
> -----Original Message-----
> From: r [mailto:r@jumac.com]
> Sent: Wednesday, May 22, 2002 2:51 AM
> To: php-general@lists.php.net
> 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
>