Page 1 of 1

Parse error: syntax error, unexpected T_OBJECT_OPERATOR

Posted: Wed Jan 28, 2009 8:43 pm
by fairyprincess18
I'm getting the following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR

I know its being generated by this line as a result of my web host using php 4 and not 5:

Code: Select all

 
<?php
if (!$skype->client()->isRunning()) {
  $skype->client()->start(true, true);
}
?>
 
Apparently Php 4 cannot handle this type of function call chaining.

One workaround is use a temp variable like this:

Code: Select all

 
<?php
$skype = client();
if (!client()->isRunning()) {
  $skype->client()->start(true, true);
}
?>
 
i realize this is probably not right, can anyone help?

Re: Parse error: syntax error, unexpected T_OBJECT_OPERATOR

Posted: Wed Jan 28, 2009 8:47 pm
by requinix
No, that's about right. Can't chain stuff together like that in PHP 4 so you're stuck with using a temporary variable or redesigning your objects.