If this is your first visit, check our documentation. To post, register or login.
Forums / Code Collaboration / PHP 7.4: Nesting ternary operators without explicit parentheses is deprecated

PHP 7.4: Nesting ternary operators without explicit parentheses is deprecated

Started by lat9 on 2 Sep 2019, 3:47 PM · Views: 15,309

Results 1 to 2 of 2
2 Sep 2019, 3:47 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

PHP 7.4: Nesting ternary operators without explicit parentheses is deprecated

As described here, with the following example:

        // Code like
        $a ? $b : $c ? $d : $e
        // should be replaced by (current interpretation)
        ($a ? $b : $c) ? $d : $e
        // or (likely intended interpretation)
        $a ? $b : ($c ? $d : $e)

Posting here because I've seen such constructs, but can't remember where.:(

9 Sep 2019, 9:51 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: PHP 7.4: Nesting ternary operators without explicit parentheses is deprecated

Zen Cart core code has already addressed that.

But of course, plugins and other code-snippets posted around the forum may not have.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.