1--TEST-- 2JIT IDENTICAL: 002 Comparison with NaN 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.file_update_protection=0 7opcache.protect_memory=1 8--EXTENSIONS-- 9opcache 10--FILE-- 11<?php 12function t() { 13 echo "!"; 14 return true; 15} 16function f() { 17 echo "!"; 18 return false; 19} 20$a = 0.0; 21$b = 0.0; 22$c = 1.0; 23$d = NAN; 24var_dump($a === $b); 25var_dump($a === $c); 26var_dump($a === $d); 27var_dump($a !== $b); 28var_dump($a !== $c); 29var_dump($a !== $d); 30var_dump($a === $b ? 1 : 0); 31var_dump($a === $c ? 1 : 0); 32var_dump($a === $d ? 1 : 0); 33var_dump($a !== $b ? 1 : 0); 34var_dump($a !== $c ? 1 : 0); 35var_dump($a !== $d ? 1 : 0); 36if ($a === $b) { 37 echo "1\n"; 38} 39if ($a === $c) { 40 echo "2\n"; 41} 42if ($a === $d) { 43 echo "3\n"; 44} 45if ($a !== $b) { 46 echo "4\n"; 47} 48if ($a !== $c) { 49 echo "5\n"; 50} 51if ($a !== $d) { 52 echo "6\n"; 53} 54if ($a === $b) { 55} else { 56 echo "7\n"; 57} 58if ($a === $c) { 59} else { 60 echo "8\n"; 61} 62if ($a === $d) { 63} else { 64 echo "9\n"; 65} 66if ($a !== $b) { 67} else { 68 echo "A\n"; 69} 70if ($a !== $c) { 71} else { 72 echo "B\n"; 73} 74if ($a !== $d) { 75} else { 76 echo "C\n"; 77} 78var_dump($a === $b && t()); 79var_dump($a === $c && t()); 80var_dump($a === $d && t()); 81var_dump($a !== $b && t()); 82var_dump($a !== $c && t()); 83var_dump($a !== $d && t()); 84var_dump($a === $b || f()); 85var_dump($a === $c || f()); 86var_dump($a === $d || f()); 87var_dump($a !== $b || f()); 88var_dump($a !== $c || f()); 89var_dump($a !== $d || f()); 90$a=NAN; 91var_dump($a === $d); 92var_dump($a !== $d); 93var_dump($a === $d ? 1 : 0); 94var_dump($a !== $d ? 1 : 0); 95?> 96--EXPECT-- 97bool(true) 98bool(false) 99bool(false) 100bool(false) 101bool(true) 102bool(true) 103int(1) 104int(0) 105int(0) 106int(0) 107int(1) 108int(1) 1091 1105 1116 1128 1139 114A 115!bool(true) 116bool(false) 117bool(false) 118bool(false) 119!bool(true) 120!bool(true) 121bool(true) 122!bool(false) 123!bool(false) 124!bool(false) 125bool(true) 126bool(true) 127bool(false) 128bool(true) 129int(0) 130int(1) 131