Jump to content

parse error, unexpected T_DOUBLE_ARROW


bassplaya4string

Recommended Posts

[code]
if ($score <= 3){
$image1 = "<img src = 'images/0-3.jpg'>";
}
else if (($score >= 4) && ($score <= 7)){
$image2 = "<img src = 'images/4-7.jpg'>";
}
else (($score >= 8) && ($score <= 10)){
$image3 = "<img src = 'images/8-10.jpg'>";
}
[/code]

or...

[code]
switch ($score) {
  case >= 8 : $image3 = "<img src = 'images/8-10.jpg'>"; break;
  case >= 4 : $image2 = "<img src = 'images/4-7.jpg'>"; break;
  case <= 3 : $image1 = "<img src = 'images/0-3.jpg'>"; break;
}
[/code]

although i'm not sure i understand your logic here.. I mean, you have 3 different variables (image1,image2, image3) and depending on what score is, one of those 3 get changed.  Are you going to later on check which one exists or something? I suppose that's all up to you on what you're doing.  It just seemed odd to me..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.