Re: [PHP] substrings

2004-04-25 Thread Evan Nemerson
On Sunday 25 April 2004 01:00 pm, David T-G wrote: > Hi, all -- > > I must be having a brain fart as well as going blind because I can't find > in the manual how to do this. > > Given a string like #AABBCC or #112233 how do I get the > > 2nd-3rd > 4th-5th > 6th-7th > > position substrings so

[PHP] substr == SOLVED (was "Re: [PHP] substrings")

2004-04-25 Thread David T-G
Richard, et al -- ...and then Richard Harb said... % % $color = '#aabbcc'; % % if (strlen($color) == 7) { %echo ' r: ' . substr($color, 1, 2); [snip] D'oh! I knew it should be substr but I could never find it! I was up to page 1098 or such and muddling through all of the PCRE doc when I g

Re: [PHP] substrings

2004-04-25 Thread Richard Harb
$color = '#aabbcc'; if (strlen($color) == 7) { echo ' r: ' . substr($color, 1, 2); echo ' g: ' . substr($color, 3, 2); echo ' b: ' . substr($color, 5, 2); } elseif (strlen($color) == 4) { echo ' r: ' . str_repeat(substr($color, 1, 1), 2); echo ' g: ' . str_repeat(substr($color, 2, 1

[PHP] substrings

2004-04-25 Thread David T-G
Hi, all -- I must be having a brain fart as well as going blind because I can't find in the manual how to do this. Given a string like #AABBCC or #112233 how do I get the 2nd-3rd 4th-5th 6th-7th position substrings so I can break out the red, green, and blue values? All of the regular exp