Title: unexpected T_FUNCTION
Last modified: September 8, 2016

---

# unexpected T_FUNCTION

 *  Resolved [Joseph G.](https://wordpress.org/support/users/illumination2025/)
 * (@illumination2025)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/)
 * Parse error: syntax error, unexpected T_FUNCTION in …/public_html/wp/wp-content/
   plugins/responsive-menu/responsive-menu.php on line 37
 * php version: 5.4.24
 * The only site doing it, as far as I can tell. I just migrated from my dev server
   to bluehost. I had to migrate manually and still the site did not come up… error
   in the plugin. I deleted and reinstalled, and this is the error I receive now.
 * Any help would be greatly appreciated! 🙂
 * Thanks!
 * -joseph

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

 *  Thread Starter [Joseph G.](https://wordpress.org/support/users/illumination2025/)
 * (@illumination2025)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8157400)
 * Interesting, tried all three versions of php 5.4 as well, and still the error.
   No clue at this point. 😀
 *  Thread Starter [Joseph G.](https://wordpress.org/support/users/illumination2025/)
 * (@illumination2025)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8157498)
 * Despite what the cpanel states in the bluehost account, it’s NOT the right version
   of PHP, even after I changed the PHP Config area… so, will call Bluehost now,
   as it’s 5.2… Unreal… you would think they would get the right version showing
   in their cpanel.
 * Status Closed!
 * Hope all is well!
 *  [Garth Mortensen](https://wordpress.org/support/users/voldemortensen/)
 * (@voldemortensen)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8157598)
 * There is only one “version” of PHP 5.4 on Bluehost servers. The difference is
   fcgi, single php.ini, or regular. There is obviously something strange going 
   on here for a few reasons.
 * 1) If the Bluehost cpanel says you are on a version of PHP, the only way that
   can be changed is if you have custom handlers in your .htaccess or changing it
   in the cpanel interface. If there is a bug in our interface please report it 
   and I will personally investigate it. Please check your .htaccess file and make
   sure that aren’t any custom PHP handlers overriding Bluehost’s configuration.
 * 2) This plugin supposedly checks the PHP version and deactivates itself if its
   using less than PHP 5.4. Either the plugin author doesn’t know what they’re doing
   or there’s just an accidental error in their code. I like to give the benefit
   of the doubt and assume its an accidental bug.
 * Either way, please report your findings.
 *  Thread Starter [Joseph G.](https://wordpress.org/support/users/illumination2025/)
 * (@illumination2025)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8157629)
 * Thanks for the response, and perhaps someone will find it of use.
 * After being on hold for a little under thirty minutes, the tech guy straightened
   it out. Our connection was poor, so we didn’t discus, just trying our best to
   understand the bare minimum in discussion. He ‘fixed’ it, whatever was happening.
 * In the cpanel, it showed one thing, but phpinfo() was showing something else.
   I would have asked more information, but again, the connection was sooooooooooooo
   bad, it was amazing we even got through what we did.
 * For others, if you see one version in your cpanel at bluehost, perhaps still 
   try to create a file like test.php with the following code in it, just to double
   check if it’s the ‘right’/matching version:
 *     ```
       <?php phpinfo(); ?>
       ```
   
 * If they are different, perhaps it’s time to give bluehost a call.
 * So, all good here!
 * Appreciate your help and all that you have done in offering such a wonderful 
   plugin.
 * Hope all is well!
 * Sincerely,
 * -joseph
    -  This reply was modified 9 years, 8 months ago by [Joseph G.](https://wordpress.org/support/users/illumination2025/).
 *  Plugin Contributor [responsivemenu](https://wordpress.org/support/users/responsivemenu/)
 * (@responsivemenu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8160155)
 * > “This plugin supposedly checks the PHP version and deactivates itself if its
   > using less than PHP 5.4. Either the plugin author doesn’t know what they’re
   > doing or there’s just an accidental error in their code. I like to give the
   > benefit of the doubt and assume its an accidental bug.”
 * Excuse me? – My plugin does a very, very simple check of the global PHP Variable
   PHP_VERSION to check the PHP Version, I cant make it anymore simple than that
   and I certainly do know what I’m doing and there is no bug.
 * It seems Bluehost is the issue here so please don’t try to pass the buck.
 * Joseph – thanks for letting me know that you finally got this fixed with Bluehost.
 * All the best
    -  This reply was modified 9 years, 8 months ago by [responsivemenu](https://wordpress.org/support/users/responsivemenu/).
 *  Thread Starter [Joseph G.](https://wordpress.org/support/users/illumination2025/)
 * (@illumination2025)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8160203)
 * > Joseph – thanks for letting me know that you finally got this fixed with Bluehost.
 * You bet, and as always, wonderful job… keep up the GREAT work!
 * Sincerely,
 * -j
 *  [Garth Mortensen](https://wordpress.org/support/users/voldemortensen/)
 * (@voldemortensen)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8160536)
 * I’m not passing the buck, and here’s why.
 *     ```
       if(version_compare(PHP_VERSION, '5.4', '<'))
         return;
   
       ...
   
       /* Internationalise the plugin */
       add_action('plugins_loaded', function() {
         load_plugin_textdomain('responsive-menu', false, basename(dirname(__FILE__)) . '/translations/');
       });
       ```
   
 * Obviously you’re checking the PHP constant here. But PHP syntax errors (which
   this is) happen before any code is executed. The way for you to fix this error
   is to put all code that isn’t < 5.4 compatible into another file and do something
   like this.
 *     ```
       if(!version_compare(PHP_VERSION, '5.4', '>')) {
          return;
       } else {
          # load code that would otherwise fatal
          include_once 'otherfile.php';
       }
       ```
   
 * The one thing that does seem like it *MIGHT* be a Bluehost problem is that the
   PHP version seemed to not be switching when Joseph was changing it. But that 
   issue seems to have been resolved by Bluehost tech support.
 *  Plugin Contributor [responsivemenu](https://wordpress.org/support/users/responsivemenu/)
 * (@responsivemenu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8175037)
 * Hi there,
 * It works fine on all systems except those using lower than PHP 5.3 but if someone
   is still on PHP 5.2 they seriously need to consider their hosting provider.
 * All the best
 *  [Garth Mortensen](https://wordpress.org/support/users/voldemortensen/)
 * (@voldemortensen)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8175070)
 * Of course it does! PHP 5.3 is when closure support was added, hence there’s no
   syntax error and your code works fine. We don’t disagree on PHP 5.2, but for 
   some its still a requirement. If you want to *properly* handle this case, you
   will update your code. If you don’t, then you’re acknowledging you don’t care
   about the user experience for those forced into using 5.2.
 *  Plugin Contributor [responsivemenu](https://wordpress.org/support/users/responsivemenu/)
 * (@responsivemenu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8175691)
 * Hi there,
 * Fair point and yes its because of closure support, I am aware of that (oh no 
   wait I dont know what Im doing so maybe I didnt)…
 * Of course I care about users but even WordPress say that 5.2 has reached end 
   of life and has security vunerablities and not to use it.
 * In an ideal world no I wouldnt support PHP 5.2 as it is not even supported by
   PHP and hasnt been for so long I cant believe any hosting company still does.
 * I will take your thoughts on board though and hopefully we can get people off
   of PHP 5.2 ASAP!
 * All the best

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

The topic ‘unexpected T_FUNCTION’ is closed to new replies.

 * ![](https://ps.w.org/responsive-menu/assets/icon-256x256.png?rev=1782326)
 * [Responsive Menu - Create Mobile-Friendly Menu](https://wordpress.org/plugins/responsive-menu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/responsive-menu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/responsive-menu/)
 * [Active Topics](https://wordpress.org/support/plugin/responsive-menu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/responsive-menu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/responsive-menu/reviews/)

## Tags

 * [unexpected T_function](https://wordpress.org/support/topic-tag/unexpected-t_function/)

 * 10 replies
 * 3 participants
 * Last reply from: [responsivemenu](https://wordpress.org/support/users/responsivemenu/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/unexpected-t_function-5/#post-8175691)
 * Status: resolved