0
if ($opts['width'] == 'fs' || $opts['height'] == 'fs' || $opts['ratio'] == 'fs') {
    var_dump($opts); // result of this see bellow
}

var_dump($opts) 内部(!) if ステートメントの結果:

array(3) {
   'width' => int(200)
   'height' => int(0)
   'ratio' => int(0)
}

これはどのように可能ですか?配列の値のどれも (攪拌) fs ではありませんか?

4

1 に答える 1

3

なぜなら0 == 'fs'。こちらの換算表をご覧ください。

PHP には、値===の両方を比較する演算子があります。

より広範なテーブルの場合: PHP での型ジャグリングと (厳密な) 大なり小なり比較

于 2013-08-24T18:20:58.463 に答える