Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

PHP error


Go to End


2 Posts   776 Views

Avatar
servalman

Community Member, 211 Posts

22 July 2010 at 10:59pm

Hi

Can someone tells me what's wrong with this :

public function hasPress()
{
if ($this->PressRelease == '') then return false;
else return true;
}

I'm getting an unexpected T_RETURN but I don't know what to correct all the ; seems to be in the right place

thanks

Avatar
Mad_Clog

Community Member, 78 Posts

22 July 2010 at 11:04pm

Edited: 22/07/2010 11:19pm

This is pretty basic PHP...
if (...) { ... } else { ... }
Don't use 'then'

On another note, you could just do the following

return ($this->PressRelease != '');