Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End If/else statement INSIDE foreach?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #33535
    stevendeeds
    Member

    Here’s what i’m trying to do.. foreach but with some conditionals


    $current = $display;
    ?>

    foreach ($page_numbers as $page_number)
    {
    echo '';
    if ($page_number == $current)
    {
    echo '{$page_number} ';
    }
    else
    {
    echo $page_number;
    }
    echo ''
    }

    ?>

    It’s saying there’s a Parse error: syntax error, unexpected ‘}’, expecting ‘,’ or ‘;’

    I don’t see why this wouldn’t work, but it’s not. WHY?!

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.