久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <tfoot id='PsyoK'></tfoot>

    <small id='PsyoK'></small><noframes id='PsyoK'>

    <legend id='PsyoK'><style id='PsyoK'><dir id='PsyoK'><q id='PsyoK'></q></dir></style></legend>
        <bdo id='PsyoK'></bdo><ul id='PsyoK'></ul>
    1. <i id='PsyoK'><tr id='PsyoK'><dt id='PsyoK'><q id='PsyoK'><span id='PsyoK'><b id='PsyoK'><form id='PsyoK'><ins id='PsyoK'></ins><ul id='PsyoK'></ul><sub id='PsyoK'></sub></form><legend id='PsyoK'></legend><bdo id='PsyoK'><pre id='PsyoK'><center id='PsyoK'></center></pre></bdo></b><th id='PsyoK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PsyoK'><tfoot id='PsyoK'></tfoot><dl id='PsyoK'><fieldset id='PsyoK'></fieldset></dl></div>

        PHP 錯誤:未加括號的 `a ?乙:丙?d : e` 已棄用.使用

        PHP Error : Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`(PHP 錯誤:未加括號的 `a ?乙:丙?d : e` 已棄用.使用`(a ? b : c) ?d : e` 還是 `a ?b : (c ? d : e)`) - IT屋-程

        • <bdo id='l3Iu5'></bdo><ul id='l3Iu5'></ul>

          <small id='l3Iu5'></small><noframes id='l3Iu5'>

                  <tbody id='l3Iu5'></tbody>
                <legend id='l3Iu5'><style id='l3Iu5'><dir id='l3Iu5'><q id='l3Iu5'></q></dir></style></legend>
              1. <tfoot id='l3Iu5'></tfoot>

                <i id='l3Iu5'><tr id='l3Iu5'><dt id='l3Iu5'><q id='l3Iu5'><span id='l3Iu5'><b id='l3Iu5'><form id='l3Iu5'><ins id='l3Iu5'></ins><ul id='l3Iu5'></ul><sub id='l3Iu5'></sub></form><legend id='l3Iu5'></legend><bdo id='l3Iu5'><pre id='l3Iu5'><center id='l3Iu5'></center></pre></bdo></b><th id='l3Iu5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='l3Iu5'><tfoot id='l3Iu5'></tfoot><dl id='l3Iu5'><fieldset id='l3Iu5'></fieldset></dl></div>

                  本文介紹了PHP 錯誤:未加括號的 `a ?乙:丙?d : e` 已棄用.使用`(a ? b : c) ?d : e` 還是 `a ?b : (c ? d : e)`的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在將 PHP 7.4 用于 Laravel 應(yīng)用程序,并且我經(jīng)常收到此異常.

                  ErrorException (E_DEPRECATED)無括號的`a ?乙:丙?d : e` 已棄用.使用`(a ? b : c) ?d : e` 還是 `a ?b : (c ? d : e)`

                  觸發(fā)這個異常的代碼是:

                  foreach ($allLanguages as $languageKey) {$original[$languageKey] =isset($values[$languageKey])?$values[$languageKey]: isset($filesContent[$fileName][$languageKey][$key]) ?$filesContent[$fileName][$languageKey][$key] : '';}

                  有人能幫我解決這個問題嗎?

                  發(fā)現(xiàn)這是由于 PHP 中的某些升級導(dǎo)致的 E_DEPRECATED 錯誤,但是有什么方法可以通過將不推薦使用的代碼轉(zhuǎn)換為最新代碼來解決此異常?

                  解決方案

                  在 php 中進(jìn)行了此更改以消除決策樹中的歧義,以便有明確的條件執(zhí)行順序.

                  棄用警告在此處轉(zhuǎn)載:

                  代碼:

                  $allLanguages = ['en', 'es', 'fr'];$values = ['es' =>'西班牙語1'];$文件內(nèi)容 = ['富' =>['es' =>['酒吧' =>'西班牙語2'],'fr' =>['酒吧' =>'法語']]];$文件名 = 'foo';$key = 'bar';$原始 = [];foreach ($allLanguages as $languageKey) {$original[$languageKey] =isset($values[$languageKey])?$values[$languageKey]: isset($filesContent[$fileName][$languageKey][$key])?$filesContent[$fileName][$languageKey][$key]: '';}var_export($original);

                  輸出:

                  <塊引用>

                  已棄用:未加括號的 `a ?乙:丙?d : e` 已棄用.使用`(a ? b : c) ?d : e` 還是 `a ?b : (c ? d : e)` 在第 17 行的/in/TG4g2

                  數(shù)組 ('en' =>'','es' =>'西班牙語2','fr' =>'法語',)

                  作為腳本的人類讀者,我會假設(shè)從左到右讀取您的條件——但這會將 Spanish1 作為輸出值.

                  即使在 php7.4 之前,輸出也是Spanish2,因為后者在決策樹中的分叉被優(yōu)先考慮.

                  為避免這種情況,您必須將條件括在括號中,以準(zhǔn)確說明應(yīng)如何處理執(zhí)行順序.

                  另外,我同意@Laurel 的觀點(diǎn),在 php7 中是時候讓您接受空合并運(yùn)算符的句法甜蜜了.這將避免優(yōu)先級問題和使用括號的需要,但根據(jù)您想要的結(jié)果,您可能需要對條件重新排序.

                  優(yōu)先于$values:(Demo)

                  $original[$languageKey] =$values[$languageKey]??$filesContent[$fileName][$languageKey][$key]??'';

                  優(yōu)先于$filesContent:(Demo)

                  $original[$languageKey] =$filesContent[$fileName][$languageKey][$key]??$values[$languageKey]??'';

                  附言IIRC,php 手冊建議不要在代碼清晰的基礎(chǔ)上使用這樣的嵌套三元組/條件.我不介意這種情況,我喜歡避免代碼膨脹,但其他開發(fā)人員可能會采取更純粹的立場.

                  I am using PHP 7.4 for a laravel application and I am getting this exception very frequently.

                  ErrorException (E_DEPRECATED)
                  Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`
                  

                  The code which triggers this exception is :

                  foreach ($allLanguages as $languageKey) {
                      $original[$languageKey] =
                          isset($values[$languageKey])
                              ? $values[$languageKey]
                              : isset($filesContent[$fileName][$languageKey][$key]) ? $filesContent[$fileName][$languageKey][$key] : '';
                  }
                  

                  Can any help me to resolve this issue?

                  Found that this is E_DEPRECATED error due to some upgrade in PHP, but is there any way to resolve this exception by converting the deprecated code to latest?

                  解決方案

                  This change in php has been done to remove ambiguity in the decision tree so that there is an explicit order of condition execution.

                  The deprecation warning is reproduced here:

                  Code:

                  $allLanguages = ['en', 'es', 'fr'];
                  $values = ['es' => 'Spanish1'];
                  $filesContent = [
                      'foo' => [
                          'es' => ['bar' => 'Spanish2'],
                          'fr' => ['bar' => 'French']
                      ]
                  ];
                  $fileName = 'foo';
                  $key = 'bar';
                  
                  $original = [];
                  foreach ($allLanguages as $languageKey) {
                      $original[$languageKey] =
                          isset($values[$languageKey])
                              ? $values[$languageKey]
                              : isset($filesContent[$fileName][$languageKey][$key])
                                  ? $filesContent[$fileName][$languageKey][$key]
                                  : '';
                  }
                  var_export($original);
                  

                  Output:

                  Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /in/TG4g2 on line 17
                  

                  array (
                    'en' => '',
                    'es' => 'Spanish2',
                    'fr' => 'French',
                  )
                  

                  As a human-reader of your script, I would assume the reading of your condition as left to right -- but this would place Spanish1 as the output value.

                  Even before php7.4, the output isSpanish2 because the latter fork in the decision tree is given precedence.

                  To avoid this, you must wrap your conditions in parentheses to dictate exactly how the order of execution should be handled.

                  Also, I agree with @Laurel that in php7 it is time for you to embrace the syntactic sugary sweetness that is the null coalescing operator. This will avoid precedence issues and the need to use parentheses, but depending on your desired results, you may need to reorder your conditions.

                  Priority to $values: (Demo)

                  $original[$languageKey] =
                      $values[$languageKey]
                          ?? $filesContent[$fileName][$languageKey][$key]
                              ?? '';
                  

                  Priority to $filesContent: (Demo)

                  $original[$languageKey] =
                      $filesContent[$fileName][$languageKey][$key]
                          ?? $values[$languageKey]
                              ?? '';
                  

                  P.s. IIRC, the php manual advises against the use of nested ternaries/conditionals like this on the basis of code clarity. I don't mind this scenario and I like the avoidance of code bloat, but other devs may take a more purist stance.

                  這篇關(guān)于PHP 錯誤:未加括號的 `a ?乙:丙?d : e` 已棄用.使用`(a ? b : c) ?d : e` 還是 `a ?b : (c ? d : e)`的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務(wù)器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數(shù))
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)
                  • <bdo id='UhMAl'></bdo><ul id='UhMAl'></ul>

                      <small id='UhMAl'></small><noframes id='UhMAl'>

                          <tbody id='UhMAl'></tbody>

                        <legend id='UhMAl'><style id='UhMAl'><dir id='UhMAl'><q id='UhMAl'></q></dir></style></legend>
                        <i id='UhMAl'><tr id='UhMAl'><dt id='UhMAl'><q id='UhMAl'><span id='UhMAl'><b id='UhMAl'><form id='UhMAl'><ins id='UhMAl'></ins><ul id='UhMAl'></ul><sub id='UhMAl'></sub></form><legend id='UhMAl'></legend><bdo id='UhMAl'><pre id='UhMAl'><center id='UhMAl'></center></pre></bdo></b><th id='UhMAl'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UhMAl'><tfoot id='UhMAl'></tfoot><dl id='UhMAl'><fieldset id='UhMAl'></fieldset></dl></div>
                        <tfoot id='UhMAl'></tfoot>
                          1. 主站蜘蛛池模板: 91一区二区三区在线观看 | 国产精品中文字幕在线 | 丁香五月网久久综合 | 久久久精品一区二区三区 | 自拍偷拍在线视频 | 欧美日韩中文字幕在线 | av网站在线播放 | 51ⅴ精品国产91久久久久久 | 久干网| 午夜视频在线免费观看 | 秋霞电影一区二区三区 | 日本精品一区二区三区视频 | 亚洲欧美视频一区 | 免费观看一级特黄欧美大片 | 国产91av视频在线观看 | 国产欧美一区二区三区国产幕精品 | 免费看啪啪网站 | 亚洲人人舔人人 | 亚洲逼院 | 阿v视频在线观看 | 亚洲精品视频三区 | 色视频网站免费 | yeyeav | 91视频网址 | 免费观看一级黄色录像 | 午夜精品一区二区三区在线视 | 一区二区精品视频 | 一区二区三区免费网站 | 久久久久久免费毛片精品 | 国产精品久久久久久久岛一牛影视 | 久久久夜 | 国产在线中文字幕 | 91在线视频| 美女黄18岁以下禁止观看 | 一区二区视频免费观看 | 韩国av一区二区 | 国产精品精品视频 | 欧美一级免费看 | 性大毛片视频 | 国产精品久久久久久久粉嫩 | 亚洲欧美一区二区三区国产精品 |