class Object {}
$object = new Object();
$clone = clone $object;
// no!
printf("%d\n", $object == $clone);
printf("%d\n", $object === $clone);
// no! no no..
printf("%d\n", $object instanceof $clone);
printf("%d\n", $clone instanceof $object);
// cos, this is true
printf("%d\n", $object instanceof $object);
printf("%d\n", $clone instanceof $clone);
// maybe something like this..
printf("%d\n", $clone cloneof $object);
printf("%d\n", cloneof($clone, $object));
其實我的問題是,「如何檢測克隆某個對象的對象」。PHP:檢查對象是否是克隆(任何對象)?
在同一分鐘? – Rizier123
*「經過一番搜索後,我什麼也沒找到。」* - 6分鐘前發佈了問題,之後立即給出答案。哇,很快的搜索;-) –
當然不! :)我正在工作一段時間,並在看到「回答你的問題」的同時共享。 –