久久久久久久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)`的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在將 PHP 7.4 用于 Laravel 應用程序,并且我經常收到此異常.

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

                  觸發這個異常的代碼是:

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

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

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

                  解決方案

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

                  棄用警告在此處轉載:

                  代碼:

                  $allLanguages = ['en', 'es', 'fr'];$values = ['es' =>'西班牙語1'];$文件內容 = ['富' =>['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

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

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

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

                  為避免這種情況,您必須將條件括在括號中,以準確說明應如何處理執行順序.

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

                  優先于$values:(Demo)

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

                  優先于$filesContent:(Demo)

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

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

                  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.

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

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

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
                  • <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免费在线看| 嫩草嫩草嫩草嫩草 | 国产一区二区福利 | 亚洲一区二区三区视频 | 一区在线视频 | 99久久久久久 | 日日干日日 | 国产com | www.av在线视频 | 久久天天躁狠狠躁夜夜躁2014 | 天天色影院 | 欧美18免费视频 | 欧美性猛交一区二区三区精品 | 神马午夜视频 | 国产欧美在线观看 | 日韩精品视频免费在线观看 | 精品乱子伦一区二区三区 | 国产视频在线看 | 在线国产一区 | www.男人天堂 | 久久久久亚洲精品 | 中文字幕一区在线 | www.午夜| av手机在线观看 | 视频一区二区三区在线观看 | 黄色特级片 | 国产成人精品一区二区三区视频 | 欧美在线视频免费 | 日韩精品国产精品 | 中文字幕av一区 | 黄色福利视频 | 日韩精品一区二区视频 | 精品欧美黑人一区二区三区 |