Parse error syntax error unexpected t_object_operator

New Page

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR


Asked 9 years, 10 months ago

Modified 1 year, 11 months ago

Seen 101k times

Report this ad

This question shows research effort; it is useful and clear


This question shows no research effort; unclear or not helpful


Please tick this question.

View activity on this post.

I got this error while debugging my code:

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in order.php at line 72

Here is a snippet of the code (starting at line 72):

$purchaseOrder = new PurchaseOrderFactory->instance(); $arrOrderDetails = $purchaseOrder->load($customerName);

  • php

To share

Share a link to this question

Copy link CC BY-SA 3.0


Follow this question to receive notifications

edited on August 6, 2017 at 7:21 PM

Restore Monica's user avatar3167040

Restate Monica3167040

684 9 9 silver badges 23 23 bronze badges

requestedNovember 14, 2012 at 10:33 PM

User avatar of user1825110

user1825110 user1825110

535 1 1 gold badge 5 5 silver badges 6 6 bronze badges


Add a comment | 

3 answers3

Sorted by: Reset to default

High score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)

This answer is helpful


This answer is not helpful

View activity on this post.

Unfortunately, it is not possible to call a method on a newly created object before PHP 5.4.

In PHP 5.4 and later, the following can be used:

$purchaseOrder = (new PurchaseOrderFactory)->instance();

Note the required pair of parentheses.

In earlier versions, you must call the method on a variable:

$purchaseFactory = new PurchaseOrderFactory; $purchaseOrder = $purchaseFactory->instance();


Share a link to this answer

Copy link CC BY-SA 4.0


Follow this answer to receive notifications

modified on March 6, 2020 at 1:27 PM

answeredNovember 14, 2012 at 10:36 PM

SirDarius user avatar

SirDarius SirDarius

39.8k 8 8 gold badges 84 84 silver badges 99 99 bronze badges


  • of them

    Even if he used his code on PHP 5.4 it would generate a syntax error.

    – Muntachir Akon

    October 15, 2015 at 1:48 PM

Add a comment | 

Report this ad

This answer is helpful


This answer is not helpful

View activity on this post.

replace with since your syntax is invalid:

$purchaseOrder = PurchaseOrderFactory::instance(); $arrOrderDetails = $purchaseOrder->load($customerName);

where presumably instance() creates an instance of the class. You can do this instead of saying new


Share a link to this answer

Copy link CC BY-SA 3.0


Follow this answer to receive notifications

answeredNovember 14, 2012 at 10:34 PM

Samuel Cook user avatar

Samuel CookSamuel Cook

16.2k 6 6 gold badges 48 48 silver badges 61 61 bronze badges


  • this code works for php version 4.9. But why does this error occur?

    – Madhourya Gandi

    June 5, 2017 at 9:09 PM

Add a comment | 

This answer is helpful


This answer is not helpful

View activity on this post.

You cannot use (this is invalid php syntax):


You probably meant one of these:

// Initialize the new object of class PurchaseOrderFactory new PurchaseOrderFactory(); // Clone instance of existing PurchaseOrderFactory clone PurchaseOrderFactory::instance(); // Just use an instance PurchaseOrderFactory::instance(); // Initialize the new object and use one of its methods $tmp = new PurchaseOrderFactory(); $tmp->instance();


Share a link to this answer

Copy link CC BY-SA 3.0


Follow this answer to receive notifications

answeredNovember 14, 2012 at 10:35 PM

Vyktor user avatar


20.1k 5 5 gold badges 59 59 silver badges 95 95 bronze badges

Add a comment | 

Question très active . Gagnez 10 points de réputation (sans compter le bonus d’association) afin de répondre à cette question. L’exigence de réputation aide à protéger cette question contre les spams et les activités sans réponse.

Pas la réponse que vous cherchez? Parcourir les autres questions étiquetées

  • php

ou posez votre propre question.

  • Le blog à débordement
  • Ethereum fusionne enfin, les semi-conducteurs restent rares (Ep. 490)

  • Tendances de débordement de pile : activité du site en semaine et le week-end

  • Présenté dans Meta
  • Modifications récentes du contraste des couleurs et mises à jour d’accessibilité

  • Réviseur par-dessus bord ! Ou une demande d’amélioration du guide d’intégration pour les nouveaux…

  • Mise à jour collective : membres reconnus, articles et GitLab

  • Dois-je expliquer les réponses en code des autres ?

Report this ad



Parse error: syntax error, unexpected T_OBJECT_OPERATOR in mail.php at line 4


Payload Object T Operator Error


Laravel Abstract Class Repository


Facebook Login PHP SDK 4.4


PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expects ‘)’


syntax error, unexpected T_OBJECT_OPERATOR? Facebook


CakePHP 3 showing blank white page


php – class DbQuery() and T_OBJECT_OPERATOR


Partial amount of PHP visible on the web page



How can I prevent SQL injection in PHP?


Delete an element from an array in PHP


How do you parse and process HTML/XML in PHP?


Reference — What does this symbol mean in PHP?


How does PHP ‘foreach’ actually work?


Reference – What does this error mean in PHP?


Why shouldn’t I use mysql_* functions in PHP?


In PHP, why doesn’t </script> show a parse error?


What does yield mean in PHP?


PHP parsing/syntax errors; and how to solve them

burning questions from the net

  • How do non-English speakers navigate JFK airport?
  • How to breed the Lilim for real?
  • What’s wrong with the planet Kenari in Andor?
  • What license can protect the owner of a project and give ownership of voluntary contributions?
  • It’s just magic
  • Python decibels with metric precision?
  • À la recherche d’une nouvelle de science-fiction sur des extraterrestres collectant la chaleur d’une sonde
  • Extraire des données d’une table imbriquée donnée
  • Une forêt de pins pourrait-elle survivre à des chutes de neige toute l’année ?
  • Comment résoudre ce sudoku sans deviner ?
  • Faire muter les valeurs de colonne en NA chaque fois que le nom de la colonne apparaît dans une colonne différente
  • Créer un raccourci de grignotage
  • Quel est le plus gros avion jamais piloté sans pilote à bord ?
  • Quel est le cas d’utilisation de la désactivation d’un index ?
  • Cryptage ROT13 utilisant l’indexation de tableau
  • Des conseils pour écrire des scènes entre personnages où il n’y a pas d’action ?
  • Comment supprimer automatiquement un élément de stockage (données vectorielles) après un intervalle de temps ?
  • À quel jeu vidéo joue Spiderhead (2022) ?
  • var() is not equal to sd()^2 in R
  • Discontinuity crossing with complex background
  • Understand what makes it up
  • Is it better to merge my SOPs and PSs into one try or just merge the two files one after the other to create a single file?
  • Are university groups allowed to use grant funds for currency hedging?
  • Anatomy of the window, for example

hotter questions

question flow

Subscribe to RSS

question flow

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Support » Plugin: Ninja Forms Contact Form – The Drag and Drop Form Builder for WordPress » Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR)

Error de análisis: error de syntax, ‘->’ unexpected (T_OBJECT_OPERATOR)

  • Resolved 248a426bc0ce48f180aa13789937d375marcusr44


    10 months, 1 week ago


    Hoping you can help. We just updated Ninja Forms plugin to latest update and it caused the site to go down. I renamed the file to deactivate the plugin so I could see the error. The error appearing is:

    Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR) in /home/composi5/public_html/wp-content/plugins/ninja-forms/includes/Routes/Submissions.php on line 716

    Any ideas what I can do to fix this please?


    The page I need help with: [log in to see the link]

Viendo 5 respuestas – 1 to 5 (of 5 in total)

  • 27a9cf0368a4376a371ae3cf9c911e07renemanuel92


    10 months ago

    I have the same problem, in fact I had to deactivate the plugin



    10 months ago

    I had the same problem, the plugin was disabled.

    The solution was to update the PHP version from 5.6 to 7.3. I was then able to re-enable the plugin and everything is working fine now.

    Plugin Contributor a0ffd26e75f76e5bb4cc46ddee5a08ebJustin McElhaney


    9 months, 2 weeks ago

    @marcusr44 @renemanuel92 I’m sorry for the inconvenience. @hinsert is right. Can you please update your PHP version to at least PHP 7.2 and let us know if you are still having the same issue. WordPress recommends PHP 7.4 or later.



    9 months, 2 weeks ago

    This also happens in PHP 7.4 and 8.0:

    Parse Error: Syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR) in /(path)/wp-content/plugins/ninja-forms/includes/Routes/Submissions.php at line 717

    • This answer was modified 9 months, 2 weeks ago by . 70df2f4fca85fe6fd480ddbee3e163b1ericksonstudio



    8 months, 3 weeks ago

    ok, which version is it? I need to update, but I want to know on which version the ninja forms start working.

Showing 5 answers – 1 to 5 (of 5 total)

  • The topic ‘Parse error: syntax error, ‘->’ unexpected (T_OBJECT_OPERATOR)’ is closed and no longer allows replies.

Video Parse error syntax error unexpected t_object_operator

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…