Page 1 of 1

help with an IF statement

Posted: Sat May 14, 2005 9:16 pm
by SidewinderX
hello am almost done with this project i just need a little help with an if statement i think...

right now i have my code like this

Code: Select all

//Time Played
$time_played = stristr($stats, 'Time Played');
sscanf($time_played, 'Time Played %s %s %s %s %s %s' , $time_played,$time_played1,$time_played2,$time_played3,$time_played4,$time_played5);
what i want to do is create something that will check "$time_played2" and if $time_played2 = days i want it to display it this
$time_played,$time_played1,$time_played2,$time_played3,$time_played4,$time_played5
however if $time_played5 = Kills i want it to just display this
$time_played,$time_played1,$time_played2,$time_played3
could someone show me how this is done? thanks in advanced

Posted: Sat May 14, 2005 9:30 pm
by Skara

Code: Select all

if ($time_played2 == 'days') {
  // display $time_played,$time_played1,$time_played2,$time_played3,$time_played4,$time_played5
}
elseif ($time_played5 == 'Kills') {
  //display $time_played,$time_played1,$time_played2,$time_played3
}
else {
  // ??
}
That what you wanted? O.o