1

Got this little bit of PHP, i keep getting a syntax error for.

Parse error: syntax error, unexpected '}' in C:\wamp\www\portfolio\index.php on line 22

        include("pages/header.php");
            $allowed = array('about', 'header', 'index' , 'home'); // add the pagenames you need
            $page = ( isset($_GET['home']) ) ? $_GET['home'] : 'index';
            if ( in_array($allowed, $page) ){
                include("pages/$page.php");
            } 
            // else {
            //     include("pages/404.php");
            // }
        ?>

By adding an opening { I then get rid of the original error and then get faced with a table that holds this information:

#   Time    Memory  Function    Location
1   0.0003  241728  {main}( )   ..\index.php:0
2   0.0004  243232  in_array ( )    ..\index.php:20

not sure what these values mean or how to go about rectifying the problem.

factordog
  • 599
  • 5
  • 24
  • @rizier123 If you read correctly, I explained that I looked into the opening and closing of it already, but it didnt solve the issue. So marking me down before looking more into is a bit silly. anyways... – factordog Jan 17 '16 at 07:40
  • @RaviHirani I put it in then gave me another error :/ which is what i said in my question – factordog Jan 17 '16 at 07:40
  • can you post another error? – Ravi Hirani Jan 17 '16 at 07:41
  • You certainly need a `{` after the `if` statement because 2 lines down you have `} else ...` - that closing bracket needs an opening bracket.. The other error you see is likely a different error elsewhere in the code. – DACrosby Jan 17 '16 at 07:42
  • Well I dont really get an error anymore when I added it, so was a bit confused on what it was. Ill post it in the question to show you – factordog Jan 17 '16 at 07:44

0 Answers0