Using an If-else within an array

后端 未结 10 1954
滥情空心
滥情空心 2020-12-11 04:45

Hi guys I have no idea if this is possible or if there is another way of doing it but any help would be appreciated. What I\'m trying to do is turn off arrays individually.

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-11 05:06

    Encountered this problem, when was setting up PDO debug mode, that is dependent on config settings.

    Examples above were great but a bit ambiguous, so I decided to write another, simple example of how to do it:

    array(
        'key' => $variable ? 'Sets certain value if $variable === true' : 'Sets certain value if $variable === false'
    );
    

提交回复
热议问题