Jump to content

IF statements inside arrays


Unholy Prayer

Recommended Posts

Is it possible to put an IF statement inside an array?  I want to display a member's IP adderess but only to admins/moderators and need an if statement to do it.  I have the address displayed in a template file in which i have arrays replacing words with strings.  I don't want to have any php in the template file so would the following work?

 


'IP_ADDRESS' => if($perm == 1){ echo "$ip_address"; },

 

Would that work?  If not, I know there are other ways to do it, but I'm not sure what they are.  How else could I do this?

Link to comment
https://forums.phpfreaks.com/topic/48191-if-statements-inside-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.