# PHP Deprecated: Unparenthesized

**URL:** <https://www.phphelp.com/t/php-deprecated-unparenthesized/32854>\
**Category:** General PHP Help\
**Created:** [November 28, 2020, 4:52am UTC](https://www.phphelp.com/t/php-deprecated-unparenthesized/32854 "2020-11-28T04:52:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![udayasl](https://www.phphelp.com/letter_avatar_proxy/v4/letter/u/c89c15/32.png) [@udayasl](https://www.phphelp.com/u/udayasl)\
**Post date:** [November 28, 2020, 4:52am UTC](https://www.phphelp.com/t/php-deprecated-unparenthesized/32854/1 "2020-11-28T04:52:56Z")

</div>

After upgrading PHP version from 7.3 to 7.4 I’m getting one deprecated issue.

```
[27-Nov-2020 01:14:32 UTC] PHP Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/lankalk/public_html/chat/sender.php on line 364

```

In line 364 of sender.php has following code:

```
$img_ext = ($image_sizes[2] == 1)? "gif" : ($image_sizes[2] == 2) ? "jpg":"png";

```

Please help me to fix this code

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [November 28, 2020, 5:25am UTC](https://www.phphelp.com/t/php-deprecated-unparenthesized/32854/2 "2020-11-28T05:25:00Z")

</div>

Welcome to the Forum.

The error message shows you exactly what to do. Did you try what it says?

`$img_ext = $image_sizes[2] == 1 ? 'gif' :($image_sizes[2] == 2 ? 'jpg' : 'png');`

---

<div class="post-metadata">

**Author:** ![udayasl](https://www.phphelp.com/letter_avatar_proxy/v4/letter/u/c89c15/32.png) [@udayasl](https://www.phphelp.com/u/udayasl)\
**Post date:** [November 28, 2020, 5:56am UTC](https://www.phphelp.com/t/php-deprecated-unparenthesized/32854/3 "2020-11-28T05:56:54Z")

</div>

@benanamen Your code fix is correct. Thank you!
