Best Syntax

Ask about a PHP problem here.
Post Reply
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Best Syntax

Post by unemployment »

What is the best syntax for this? I don't even know if the last part of this works.
$data[0][$k]['message'] = 'You have successfully joined <a href="../c/'.$r['companytag'].'">'.$r['feedfirstname'].'</a> in '.industry($r['industry']).' at '.stage($r['stage']).' stage'.if (empty($otherfans)){"."};
Tino
Posts: 360
Joined: Thu May 05, 2011 8:55 pm
Location: The Netherlands

Re: Best Syntax

Post by Tino »

Well, have you tried if it works? :?

That all looks fine except for the last part. You cannot use an if statement like that.
Please check out my CodeCanyon items.
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Best Syntax

Post by unemployment »

Tino wrote:Well, have you tried if it works? :?

That all looks fine except for the last part. You cannot use an if statement like that.
Yeah, the last part fails. Do you know how to properly write this?
Tino
Posts: 360
Joined: Thu May 05, 2011 8:55 pm
Location: The Netherlands

Re: Best Syntax

Post by Tino »

You would just do
$string = 'my string';

if ( empty($otherfans) ) { $string .= '.'; }
obviously replacing 'my string' with what you put in the first post.
Please check out my CodeCanyon items.
Post Reply