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, 2020 in PHP by kartik
• 37,520 points
5,261 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, 2020 by Niroj
• 82,840 points

Related Questions In PHP

0 votes
0 answers

Parse error: Syntax error, unexpected end of file in my PHP code

I am getting this error: Parse error: syntax ...READ MORE

Jun 10, 2022 in PHP by narikkadan
• 63,600 points
2,321 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, 2020 in PHP by Niroj
• 82,840 points
37,525 views
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, 2020 in PHP by Niroj
• 82,840 points
1,417 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, 2020 in PHP by Niroj
• 82,840 points
6,450 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

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

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,995 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,918 views
+1 vote
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, 2020 in Laravel by Niroj
• 82,840 points
44,691 views
0 votes
1 answer

PHP Parse error: syntax error, unexpected T_IMPLEMENTS, expecting '{' in X on line Y

Hello @kartik, You are looking for the extends keyword: Interface IFoo ...READ MORE

answered Nov 5, 2020 in PHP by Niroj
• 82,840 points
2,025 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, 2020 in PHP by Niroj
• 82,840 points
1,540 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP