Jump to content

Archived

This topic is now archived and is closed to further replies.

piney

Playing time

Recommended Posts

I have set $s8 - $s12 as names

[code]<?php
$loop = 8;
$time = date('H') - 12;

while ($loop <= 12) {
if ($s['$loop'] == Lavish) && ($time == $loop) {
  echo "Lavish is playing now!";
}
elseif ($s['$loop'] == Lavish) && ($time > $loop) {
  echo "Lavish is played at $loop";
}
elseif ($s['$loop'] == Lavish) && ($time < $loop) {
  echo "Lavish is playing at $loop";
}
else echo 'Lavish is not playing this week';
  $loop++;
}?>[/code]

I get error "unexpected T_BOOLEAN_AND"
any ideas??

Share this post


Link to post
Share on other sites
if ($s['$loop'] == Lavish) && ($time == $loop)

Should be

if (($s['$loop'] == Lavish) && ($time == $loop) )

Missed a set of brackets on all conditions.

Share this post


Link to post
Share on other sites
That worked but my code dont work... if $loop = 10
$s['$loop'] should = $s10 right???

or how would i get that to work???

Share this post


Link to post
Share on other sites
if $loop =10 then[code]
${'s'.$loop}
[/code]is $s10

Share this post


Link to post
Share on other sites

×

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.