title: Syntax error, unexpected '{' when using the Facebook PHP-SDK
body: <p>I'm trying to get my team's Flash project on Facebook, but I cannot get any of the PHP-SDK examples to work.  I've followed several examples, such as this new one on github (<a href="https://github.com/facebook/php-sdk/blob/master/examples/example.php" rel="nofollow">here</a>).  However, I keep getting a parse error:</p>
  
  <blockquote>
    <p>Parse error: syntax error, unexpected '{' in
    /home/content/r/a/s/rashomon/html/projects/facebook/test/hellomyflash/index.php
    on line 36</p>
  </blockquote>
  
  <p>I downloaded the latest PHP-SDK.  Here's my file structure:</p>
  
  <pre><code>.../hellomyflash/
  
     index.php
  
     src/base_facebook.php
  
     src/facebook.php
  
     src/fb_ca_chain_bundle.crt
  </code></pre>
  
  <p>The only two lines I changed in index.php are the appId and secret.</p>
  
  <p>index.php :</p>
  
  <pre><code>&lt;?php
  /**
   * Copyright 2011 Facebook, Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License"); you may
   * not use this file except in compliance with the License. You may obtain
   * a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   * License for the specific language governing permissions and limitations
   * under the License.
   */
  
  require '../src/facebook.php';
  
  // Create our Application instance (replace this with your appId and secret).
  $facebook = new Facebook(array(
    'appId'  =&gt; '###############',
    'secret' =&gt; '################################',
  ));
  
  // Get User ID
  $user = $facebook-&gt;getUser();
  
  // We may or may not have this data based on whether the user is logged in.
  //
  // If we have a $user id here, it means we know the user is logged into
  // Facebook, but we don't know if the access token is valid. An access
  // token is invalid if the user logged out of Facebook.
  
  if ($user) {
    try {
      // Proceed knowing you have a logged in user who's authenticated.
      $user_profile = $facebook-&gt;api('/me');
    } catch (FacebookApiException $e) {
      error_log($e);
      $user = null;
    }
  }
  
  // Login or logout url will be needed depending on current user state.
  if ($user) {
    $logoutUrl = $facebook-&gt;getLogoutUrl();
  } else {
    $loginUrl = $facebook-&gt;getLoginUrl();
  }
  
  // This call will always work since we are fetching public data.
  $naitik = $facebook-&gt;api('/naitik');
  
  ?&gt;
  &lt;!doctype html&gt;
  &lt;html xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
    &lt;head&gt;
      &lt;title&gt;php-sdk&lt;/title&gt;
      &lt;style&gt;
        body {
          font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
        }
        h1 a {
          text-decoration: none;
          color: #3b5998;
        }
        h1 a:hover {
          text-decoration: underline;
        }
      &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;php-sdk&lt;/h1&gt;
  
      &lt;?php if ($user): ?&gt;
        &lt;a href="&lt;?php echo $logoutUrl; ?&gt;"&gt;Logout&lt;/a&gt;
      &lt;?php else: ?&gt;
        &lt;div&gt;
          Login using OAuth 2.0 handled by the PHP SDK:
          &lt;a href="&lt;?php echo $loginUrl; ?&gt;"&gt;Login with Facebook&lt;/a&gt;
        &lt;/div&gt;
      &lt;?php endif ?&gt;
  
      &lt;h3&gt;PHP Session&lt;/h3&gt;
      &lt;pre&gt;&lt;?php print_r($_SESSION); ?&gt;&lt;/pre&gt;
  
      &lt;?php if ($user): ?&gt;
        &lt;h3&gt;You&lt;/h3&gt;
        &lt;img src="https://graph.facebook.com/&lt;?php echo $user; ?&gt;/picture"&gt;
  
        &lt;h3&gt;Your User Object (/me)&lt;/h3&gt;
        &lt;pre&gt;&lt;?php print_r($user_profile); ?&gt;&lt;/pre&gt;
      &lt;?php else: ?&gt;
        &lt;strong&gt;&lt;em&gt;You are not Connected.&lt;/em&gt;&lt;/strong&gt;
      &lt;?php endif ?&gt;
  
      &lt;h3&gt;Public profile of Naitik&lt;/h3&gt;
      &lt;img src="https://graph.facebook.com/naitik/picture"&gt;
      &lt;?php echo $naitik['name']; ?&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I got the same "unexpected '{'" error when following <a href="http://eagerfish.eu/example-facebook-iframe-app-using-graph-api-through-php-sdk/" rel="nofollow">this</a> example.</p>
  
  <p>What am I doing wrong???</p>