Reply to Re: beginning of a string

Your name:

Reply:


Posted by Kimmo Laine on 11/28/05 15:53

"Brian" <not@given.com> wrote in message
news:wODif.4411$uR.2961@newsfe7-gui.ntli.net...
> Hi
>
> I should know this but never had to do it, I'm trying
> to work out what the beginning of a string contains
> What I'm trying to do is this
>
> $s = 'K123456'
>
> if the beginning of a string is 'K' then do X if
> beginning of a string is 'T' then do Y
> and so on


switch($s{0}){
case 'K':
// do something
break;
case 'T':
// do something else
break;
default:
// error handler
}

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
antaatulla.sikanautaa@gmail.com.NOSPAM.invalid

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация