Jump to content

Recommended Posts

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

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/291049-parse-error/
Share on other sites

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 by Csharp
Link to comment
https://forums.phpfreaks.com/topic/291049-parse-error/#findComment-1491037
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.