0

The following line gives error in 5.4.28

(new MySocketServer())->run();

PHP Parse error:  syntax error, unexpected '->' (T_OBJECT_OPERATOR) 

but it works in PHP 5.4.4

Any ideas?

KillDash9
  • 879
  • 1
  • 8
  • 21
  • 1
    Are you *100% sure* you are running PHP 5.4? This error almost always occurs when the OP thinks they are using one version of PHP but is using another. – John Conde May 19 '14 at 18:07
  • Yes : php -v PHP 5.4.28-1~dotdeb.0 (cli) (built: May 7 2014 23:10:42) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies – KillDash9 May 19 '14 at 18:08
  • 3
  • PHP Version => 5.4.28-1~dotdeb.0 – KillDash9 May 19 '14 at 18:11
  • 1
    Couldn't reproduce it on php 5.4.9: http://codepad.viper-7.com/zk2xHE Please show more code – Nikita 웃 May 19 '14 at 18:14
  • 1
    Works fine for me in *PHP 5.4.28-1~dotdeb.1* (a slightly different version). https://gist.github.com/salathe/32f1eecbb3acb12eb6be – salathe May 19 '14 at 18:23
  • Possible duplicate of [PHP Parse/Syntax Errors; and How to solve them?](http://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – Jocelyn Jul 03 '16 at 22:02

0 Answers0