Title: Parse error: syntax error, unexpected &#039;
Last modified: August 22, 2016

---

# Parse error: syntax error, unexpected '

 *  Resolved [choazie](https://wordpress.org/support/users/choazie/)
 * (@choazie)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/)
 * Note: not a PHP version issue, my version is 5.3.29.
 * I have the following code in my template file and I’m getting a syntax error:
 *     ```
       <?php if(is_mobile()) {
       <div class="mobileoverlay">
       <div class="fullwidth">
       <div class="mobilecontainer">
       mobile content
       </div><!-- /.mobilecontainer -->
       </div><!-- /.fullwidth -->
       </div><!-- /.mobileoverlay -->
       }; ?>
       ```
   
 * Am I missing something?
 * Thanks in advance for answering my dumb questions 🙂
 * [https://wordpress.org/plugins/php-browser-detection/](https://wordpress.org/plugins/php-browser-detection/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Mindshare Labs, Inc.](https://wordpress.org/support/users/mindshare/)
 * (@mindshare)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922453)
 * That’s not valid PHP code…. you want something like this:
 *     ```
       <?php if(is_mobile()) : ?>
       	<div class="mobileoverlay">
       		<div class="fullwidth">
       			<div class="mobilecontainer">
       				mobile content
       			</div>
       			<!-- /.mobilecontainer -->
       		</div>
       		<!-- /.fullwidth -->
       	</div><!-- /.mobileoverlay -->
       <?php endif; ?>
       ```
   
 *  Thread Starter [choazie](https://wordpress.org/support/users/choazie/)
 * (@choazie)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922458)
 * Oh sorry! From the examples given, for a PHP ignoramus like me it seemed <?php
   if(is_mobile()) { your code }; ?> was the verbatim syntax, so I took it as my
   code was supposed to go where it says “your code”. Perhaps the below example 
   would be even clearer for nitwits like me, might save you future grief?
 *     ```
       <?php if(is_mobile()) : ?>
            your code
       <?php endif; ?>
       ```
   
 * Thanks again so much for getting back to me, you’re a star. The world would be
   a better place if only PHP pros used WordPress plugins but alas not! 😉
 *  Thread Starter [choazie](https://wordpress.org/support/users/choazie/)
 * (@choazie)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922464)
 * Now I’m getting:
 * `Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate
   19922944 bytes) in wp-2015/wp-content/plugins/php-browser-detection/cache/cache.
   php on line 65540`
 * [http://constantartists.com/wp-2015/jobs](http://constantartists.com/wp-2015/jobs)
 *  Plugin Author [Mindshare Labs, Inc.](https://wordpress.org/support/users/mindshare/)
 * (@mindshare)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922484)
 * Yeah that’s an issue with this plugin. It doesn’t play well with most cheap shared
   hosting packages. You only have 40mb for PHP, this plugin really requires **at
   least** 128mb to work well. The problem is that their are so many browsers and
   devices (over 10,000) in the array that it takes a lot of memory to parse and
   store.
 *  Plugin Author [Mindshare Labs, Inc.](https://wordpress.org/support/users/mindshare/)
 * (@mindshare)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922486)
 * If you can upgrade your hosting to 128mb or better still 256mb it should work,
   but I can’t promise anything.
 *  Thread Starter [choazie](https://wordpress.org/support/users/choazie/)
 * (@choazie)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922495)
 * Thanks, will talk to the host.
 *  Plugin Author [Mindshare Labs, Inc.](https://wordpress.org/support/users/mindshare/)
 * (@mindshare)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922532)
 * “Normal” who can say?
 * If you want a plugin to do what this one does, it takes more memory.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Parse error: syntax error, unexpected '’ is closed to new replies.

 * ![](https://ps.w.org/php-browser-detection/assets/icon-256x256.png?rev=999338)
 * [PHP Browser Detection](https://wordpress.org/plugins/php-browser-detection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-browser-detection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-browser-detection/)
 * [Active Topics](https://wordpress.org/support/plugin/php-browser-detection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-browser-detection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-browser-detection/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Mindshare Labs, Inc.](https://wordpress.org/support/users/mindshare/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-143/#post-5922532)
 * Status: resolved