PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR

0 votes

I got this error when debugging my code:

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in order.php on line 63

Here is a snippet of the code (starting on line 63):

$purchaseOrder = new PurchaseOrderFactory->instance();
$arrOrderDetails = $purchaseOrder->load($customerName);
May 19 in PHP by kartik
• 11,890 points
47 views

1 answer to this question.

0 votes

Hello @kartik,

Change your syntax because it  was invalid.

Updated syntax:

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

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

Thank You!!

answered May 19 by Niroj
• 23,950 points

Related Questions In PHP

0 votes
1 answer

Error:PDOException SQLSTATE[HY000] [2020] No such file or directory in php?

Hello, I checked php -i | grep pdo and noticed ...READ MORE

answered Apr 2 in PHP by Niroj
• 23,950 points
36 views
0 votes
1 answer

Error: unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING

Hello @kartik, Make sure they are running Latest ...READ MORE

answered May 8 in PHP by Niroj
• 23,950 points
147 views
0 votes
1 answer

ERROR: The file 'wp-config.php' already exists

Hello, Try to display the website first on ...READ MORE

answered May 8 in PHP by Niroj
• 23,950 points
31 views
0 votes
1 answer

Error:Enabling error display in PHP via htaccess only?

Hello, To turn the actual display of errors ...READ MORE

answered May 19 in PHP by Niroj
• 23,950 points
30 views
0 votes
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 23,950 points
475 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 23,950 points
63 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 23,950 points
68 views
0 votes
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 23,950 points
172 views
0 votes
1 answer

Complete PHP form with proper validation and syntax

Hey @kartik, It's quite simple to have php ...READ MORE

answered Feb 19 in PHP by Niroj
• 23,950 points
58 views
0 votes
1 answer

Error:“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

Hello @kartik, The best way for getting input string is: $value ...READ MORE

answered Apr 1 in PHP by Niroj
• 23,950 points
371 views