Title: syntax error, unexpected &#8216;string&#8217; (T_STRING),
Last modified: July 2, 2020

---

# syntax error, unexpected ‘string’ (T_STRING),

 *  Resolved [gringostarr](https://wordpress.org/support/users/gringostarr/)
 * (@gringostarr)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-string-t_string/)
 * I’m working on a plugin running on wamp64 and PHP 7.4.0. When I tried changing
   the PHP version to 7.3.12 I got this error:
    Parse error: syntax error, unexpected‘
   string’ (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) on the
   line indicated by >>>> in the code below.
 *     ```
       defined( 'ABSPATH' ) || exit;
       if ( ! class_exists( 'WC_Test_Integration' ) ) :
           class WC_Test_Integration extends WC_Integration {
   
       >>>>     public function __construct() { 
                }
       ```
   
 * The plugin works fine when I use PHP 7.4.0. The problem is that the plugin is
   going to be used on sites running PHP 7.3.12. Does anyone know why I’m getting
   this error?
 * Thanks
    -  This topic was modified 5 years, 11 months ago by [gringostarr](https://wordpress.org/support/users/gringostarr/).
    -  This topic was modified 5 years, 11 months ago by [gringostarr](https://wordpress.org/support/users/gringostarr/).
    -  This topic was modified 5 years, 11 months ago by [gringostarr](https://wordpress.org/support/users/gringostarr/).

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

 *  [con](https://wordpress.org/support/users/conschneider/)
 * (@conschneider)
 * Engineer
 * [5 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-string-t_string/#post-13063204)
 * Hi there,
 * Your code looks correct. Maybe:
 * * rewrite the ternary operator to a standard `if() { ... }`.
    * eliminate trailing
   white space in front of `public function __construct`.
 * Kind regards,
 *  Thread Starter [gringostarr](https://wordpress.org/support/users/gringostarr/)
 * (@gringostarr)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-string-t_string/#post-13063385)
 * Hi Con,
 * Thanks for your help. I just found out what the problem is. I
    recently started
   using typed properties which PHP 7.3.12 doesn’t support. The parse error occurred
   on a different line so I didn’t suspect the typed properties was causing the 
   problem.
 *  Thread Starter [gringostarr](https://wordpress.org/support/users/gringostarr/)
 * (@gringostarr)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-string-t_string/#post-13063396)
 * –

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

The topic ‘syntax error, unexpected ‘string’ (T_STRING),’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [gringostarr](https://wordpress.org/support/users/gringostarr/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-string-t_string/#post-13063396)
 * Status: resolved