richlacey Posted September 13, 2014 Share Posted September 13, 2014 Hi there, just wondering if anyone could cast there eyes over this, my error is Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' on line 197 this is line 197 of the file with the error, <input type="text" class="form-control" name="dob" id="dob" value="<?=(new DateTime($member['dob']))->format("d/m/Y");?>"> This was working not sure what has happend? Thanks for your help Rich Quote Link to comment Share on other sites More sharing options...
Barand Posted September 13, 2014 Share Posted September 13, 2014 you need to add parentheses echo (new DateTime('2014-09-13'))->format('d/m/Y'); //---> 13/09-2014 Quote Link to comment Share on other sites More sharing options...
Csharp Posted September 14, 2014 Share Posted September 14, 2014 (edited) It could also have to do with your PHP vesion. Older versions require you to instance the object and later use it. See this code here: <?php class Test { public function test() { return 'a'; } } echo (new Test())->test(); If you copy it into this tool you will see that versions below PHP 5.4 give a PARSE ERROR just like yours. You would need to use <?php $object = new Test(); echo $object->test(); Hope this helped. Edited September 14, 2014 by Csharp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.