xyph Posted June 21, 2012 Share Posted June 21, 2012 Software upgrade. The *solved* plugin hasn't been installed yet. Quote Link to comment https://forums.phpfreaks.com/topic/264534-syntax-errors/page/2/#findComment-1355910 Share on other sites More sharing options...
cpd Posted June 21, 2012 Share Posted June 21, 2012 OMFG is it that hard to count the parenthesise $image_properties = array( 'src' => [Open Bracket 1 ->](!empty [Open Bracket 2 ->]($this->session->userdata [Open Bracket 3 ->]('avatar')[<- Close bracket 3 )[<- Close Bracket 2 )[<- Err, oh shit, theres the bracket that shouldn't be closed] ? 'assets/peach/img/sprites/userinfo/'.$this->session->userdata('avatar') : 'assets/peach/img/sprites/userinfo/avatars/avatar.png') [<- AND OMG, who knew this is where it would close....] 'height' => '80px', 'width' => '80px', 'alt' => 'Avatar' ); And in-case you don't know what an in-line if statement is $variable = argument ? true : false; // Example $switchOn = true; $isSwitchOn = $switchOn == true ? 'Yes' : 'No'; Completed code $image_properties = array( 'src' => (!empty ($this->session->userdata('avatar') ) // OMG I REMOVED A BRACKET ? 'assets/peach/img/sprites/userinfo/'.$this->session->userdata('avatar') : 'assets/peach/img/sprites/userinfo/avatars/avatar.png') 'height' => '80px', 'width' => '80px', 'alt' => 'Avatar' ); Apologise for the sarcasm and the original mistake, this discussion wouldn't have taken place if I hadn't made the mistake. My bad... Quote Link to comment https://forums.phpfreaks.com/topic/264534-syntax-errors/page/2/#findComment-1355912 Share on other sites More sharing options...
Xtremer360 Posted June 21, 2012 Author Share Posted June 21, 2012 What I posed was the result that works. So what's for the additional code? Just an alternative way of doing it? Quote Link to comment https://forums.phpfreaks.com/topic/264534-syntax-errors/page/2/#findComment-1355919 Share on other sites More sharing options...
xyph Posted June 21, 2012 Share Posted June 21, 2012 It's pretty much the same code, yours uses an additional variable to hold the method's return value. Quote Link to comment https://forums.phpfreaks.com/topic/264534-syntax-errors/page/2/#findComment-1355942 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.