-1

Heres the code. Sorry if this is a bad question, I'm very new to PHP.

for($i = 0; $i < count($searchsingle); $i++){
    if($yougender !== $searchsingle[$i] && $youOS = $searchsingle[$i+4] && $youmin >= 
        $searchsingle[$i + 5] && $youmax <= $searchsingle[$i + 6]{
Problem Line ----> $theirname = $searchsingle[$i - 1];
        $theirgender = $searchsingle[$i];
        $theirOS = $searchsingle[$i+4];
Corjava
  • 340
  • 2
  • 6
  • 17

2 Answers2

4

You are missing your closing parenthesis for the if statement:

if($yougender !== $searchsingle[$i] && $youOS = $searchsingle[$i+4] && $youmin >= 
    $searchsingle[$i + 5] && $youmax <= $searchsingle[$i + 6]{ 

should be

if($yougender !== $searchsingle[$i] && $youOS = $searchsingle[$i+4] && $youmin >= 
    $searchsingle[$i + 5] && $youmax <= $searchsingle[$i + 6]) { // <-- It goes there
John Conde
  • 217,595
  • 99
  • 455
  • 496
  • You think after how long I've been looking at this, I would have noticed. Thank You. – Corjava Dec 11 '13 at 19:53
  • 2
    @Corjava, try a code editor that highlights code and try to use a formatting that makes spotting such bugs easier ;) – Luceos Dec 11 '13 at 19:55
0

As @John said you were missing the parenthesis

Also I notice you have $youOS = $searchsingle[$i+4] which is an assignment not a comparison it should be ==

To avoid mistakes like that use good syntax highlight like @luceos suggested

Personaly I hate long condition, break them down in smaller booleans something along the lines:

$search_gender = $yougender !== $searchsingle[$i];
$search_os =  $youOS == $searchsingle[$i+4];
$search_min = $youmin >= $searchsingle[$i + 5];
$search_max = $youmax <= $searchsingle[$i + 6];

if($search_gender && $search_os && $search_min && $search_max )
meda
  • 45,103
  • 14
  • 92
  • 122