help with an IF statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

help with an IF statement

Post 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
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post 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
Post Reply