www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help with function please...

  1. #1
    Join Date
    Jan 2007
    Posts
    11

    Help with function please...

    Hi all,

    Was hoping someone could help me. Im kind of new to php and im stuck.

    What im trying to do is an 'If then' statement i think. I have an array and ive created a variable called $rounds which is pulling its value from the array $rounds[1][0].

    The value of $rounds[1][0] will equal (1,2,3...19,20,21,Quarter-Final, Semi-Final, Grand-Final).

    Now my aim is to have the text "Round " be written as "Round 1", "Round 2" etc etc if $round equals the numbers 1-21, otherwise if $round equals Quarter-Final, Semi-Final, Grand-Final then for it just to remain as is without the "Round " written before it. I have come up with the following which doesnt work:

    PHP Code:
        <?
        $rounds
    =$rounds[1][0];
        if (
    $rounds!=("Quarter-Final|Semi-Final|Grand-Final"))
            
    $rounds="Round $rounds";
        elseif (
    $rounds==("Quarter-Final|Semi-Final|Grand-Final"))
            
    $rounds=$rounds[1][0];
        
        echo 
    $rounds;
        
    ?>
    Hope that makes sense. Any help appreciated

  2. #2
    Join Date
    Feb 2007
    Posts
    148
    something like this:

    Code:
    if ($round >= 1 && $round <= 21) 
      {echo('Round $round');}
      
      else {echo('$round');}
    i have no idea im new too but this makes sense to me

  3. #3
    Join Date
    Jan 2007
    Posts
    11
    Thanks alot Spliff, worked perfectly mate

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles