Tuesday, 15 July 2014

php - If isset Session, add to $variable or $variable='0' write with one line -


I have php code below and I want to use it in inline (one line) . It should not repeat $ _SESSION name

  $ view = if (isset ($ _ session ['customer-view']) {$ view = $ _SESSION ['cients-view']; } And {$ visual = '0';}  

As you see it $ view three times and $ _ session twice < / Strong> I repeat it with a single line in an easy way.

Hope you understand the question.

Thanks,

SL

You want it to:

  $ view = isset ($ _ Session ['customer-view'])? $ _SESSION ['Cients-view']: '0';  

I do not understand why in your code $ view = if (... ? If there is no return value. / P>


No comments:

Post a Comment