개발관련/PHP
[PHP]Comparison
파노카페
2012. 4. 20. 15:18
name = "changed box"; $another_box = new Box(); // == is casual and just checks to see if the attributes are the same echo $box == $box_reference ? 'true' : 'false'; // true echo "
"; echo $box == $box_clone ? 'true' : 'false'; // true echo "
"; echo $box == $box_changed ? 'true' : 'false'; // false echo "
"; echo $box == $another_box ? 'true' : 'false'; // true echo "
"; // === is strict and checks to see if they reference the same object echo $box === $box_reference ? 'true' : 'false'; // true echo "
"; echo $box === $box_clone ? 'true' : 'false'; // false echo "
"; echo $box === $box_changed ? 'true' : 'false'; // false echo "
"; echo $box === $another_box ? 'true' : 'false'; // false echo "
"; ?>
true
true
false
true
true
false
false
false