Basically I have a relatively complex piece of code in which has several arrays nested inside each other. I believe that what I'd like to do is not strictly possible:
$selector = true,
$main_array = array(
'general' = array(
'another_array' = array(
'option1' = array(
'title' = 'Some Title',
'type' = 'select',
if ($selector == true) {
'option2' = array(
'title' = 'Some title',
'type' = 'select',
} else
...
I know that the above is not possible. I know that I could use ternary operator but it didn't work when I tried. I know that there better ways to solve this problem, but as far I can tell, all of them would involve me changing the whole structure (as there are many arrays nested inside each other) which I don't want to do, so my question is, is there a way around that I could use to make this conditional work without me changing the whole thing?
Many thanks