Re: substr....what does this mean? (newbie)

From: Date: Tue, 21 May 2002 19:17:46 +0000
Subject: Re: substr....what does this mean? (newbie)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-98649@lists.php.net to get a copy of this message
From what it looks like, R, this code: if (substr($text, -1) == ".") {$test = substr($text, 0, -1);} checks to see if there is a period at the end of text. If there is, it simply assigns $test to be $text without the '.' . I'm rather new at this, so if someone has a counterclaim to what this might be, feel free to speak up. J. Wharton "R" <r@jumac.com> wrote in message 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. >

« previous php.general (#98649) next »