Posted by David Haynes on 01/08/06 00:05
anonymus wrote:
> <?php
>
> $substring = substr("K123456", 0, 1);
>
> if($var == "K")
> {
> // code here if the string begins with "K"
> }
> elseif($var == "T")
> {
> // code here if the string begins with "T"
> }
> ?>
>
>
or
<?php
$s = "K123456";
switch( $s[0] ) {
case 'K':
// code for K
break;
case 'T':
// code for T
break;
}
?>
Navigation:
[Reply to this message]
|