This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-09-16 17:09:55

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

PHP: Last (Number) Letters of?

What is the code for last_(any number)_letters_of("string")


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#2 2011-09-16 17:10:37

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: PHP: Last (Number) Letters of?

http://php.net/manual/en/function.substr.php

Edit: using google usually does the trick
Edit2: although to be fair, I did know that one already
Edit3: Using the exact words you typed (give or take): http://lmgtfy.com/?q=php+find+last+letters+of+string

Last edited by rookwood101 (2011-09-16 17:17:00)


http://i.imgur.com/zeIZW.png

Offline

 

#3 2011-09-16 17:15:33

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP: Last (Number) Letters of?

rookwood101 wrote:

http://php.net/manual/en/function.substr.php

Edit: using google usually does the trick
Edit2: although to be fair, I did know that one already

So what do i type. I can't exactly figure out how to set start to false.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#4 2011-09-16 17:19:21

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: PHP: Last (Number) Letters of?

PageIjustgaveyou wrote:

If start is negative, the returned string will start at the start'th character from the end of string.

PageIjustgaveyou wrote:

$rest = substr("abcdef", -1);    // returns "f".

PageIjustgaveyou wrote:

$rest = substr("abcdef", -2);    // returns "ef"

PageIjustgaveyou wrote:

$rest = substr("abcdef", -3, 1);    // returns "d"

Last edited by rookwood101 (2011-09-16 17:20:56)


http://i.imgur.com/zeIZW.png

Offline

 

Board footer