<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Zend PHP5 certification Exam study review 11: supplementary II</title>
	<atom:link href="http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/feed/" rel="self" type="application/rss+xml" />
	<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/</link>
	<description>PHP, CSS, Ajax, webdevelop and everything else.</description>
	<pubDate>Sat, 22 Nov 2008 07:27:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: admin</title>
		<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1451</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 07 Oct 2008 13:39:12 +0000</pubDate>
		<guid isPermaLink="false">http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1451</guid>
		<description>tjmcd1963, I knew what you mean. I think, maybe in the case that you want to test if a class is a singleton? E.g.:

$a = new ForeignClass();
$b = new ForeignClass();
if($a === $b) {echo "It is a singleton.";} else{echo "It is not a singleton.";}

Of coures, in the real world, this is a very rare scenario, even you got a class from somewhere, and it was not documented and has no comment, you can always check the source code of the Class right? But I also can't think another example in the real world right now. But, this is may useful in large project, and you use $a=$b; but after pass $a and $b around, in some places, you forgot you used this stating or it is just another person on the project, so use if($a===$b).
P.S., I think "the same instance of an object" is actually "the same instance of an class". The question itself seem has a problem.</description>
		<content:encoded><![CDATA[<p>tjmcd1963, I knew what you mean. I think, maybe in the case that you want to test if a class is a singleton? E.g.:</p>
<p>$a = new ForeignClass();<br />
$b = new ForeignClass();<br />
if($a === $b) {echo &#8220;It is a singleton.&#8221;;} else{echo &#8220;It is not a singleton.&#8221;;}</p>
<p>Of coures, in the real world, this is a very rare scenario, even you got a class from somewhere, and it was not documented and has no comment, you can always check the source code of the Class right? But I also can&#8217;t think another example in the real world right now. But, this is may useful in large project, and you use $a=$b; but after pass $a and $b around, in some places, you forgot you used this stating or it is just another person on the project, so use if($a===$b).<br />
P.S., I think &#8220;the same instance of an object&#8221; is actually &#8220;the same instance of an class&#8221;. The question itself seem has a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1450</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 07 Oct 2008 13:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1450</guid>
		<description>Hi Alexey, you are right. My answers were wrong, it should use unset. Actually, I knew they are wrong a long time ago; I forgot to correct it. And, later, I thought, maybe just keep it as is. I never said that all these here are the "correct answers" :). Thank you very much for your this comments!</description>
		<content:encoded><![CDATA[<p>Hi Alexey, you are right. My answers were wrong, it should use unset. Actually, I knew they are wrong a long time ago; I forgot to correct it. And, later, I thought, maybe just keep it as is. I never said that all these here are the &#8220;correct answers&#8221; :). Thank you very much for your this comments!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexey</title>
		<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1449</link>
		<dc:creator>Alexey</dc:creator>
		<pubDate>Tue, 07 Oct 2008 08:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1449</guid>
		<description>Hi!
On question
"To destroy one variable within a PHP session you should use which method in PHP 5?"
you answered
session_destroy(); session_regenerate_id();
Why? To destroy ONE variable you should use unset() method, like unset ($_SESSION['var'])
P.S. Thank you for interesting article</description>
		<content:encoded><![CDATA[<p>Hi!<br />
On question<br />
&#8220;To destroy one variable within a PHP session you should use which method in PHP 5?&#8221;<br />
you answered<br />
session_destroy(); session_regenerate_id();<br />
Why? To destroy ONE variable you should use unset() method, like unset ($_SESSION['var'])<br />
P.S. Thank you for interesting article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tjmcd1963</title>
		<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1448</link>
		<dc:creator>tjmcd1963</dc:creator>
		<pubDate>Mon, 06 Oct 2008 15:17:54 +0000</pubDate>
		<guid isPermaLink="false">http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1448</guid>
		<description>Here, $a and $b are not the same instance of an object, they are two different instance of the same class, eventhough the if statement will return true...

Ok, I see your point there, but without simply stating that $a=$b; can you provide a simple example wherein $a and $b would in fact be "the same instance of an object" never mind where $a and $b "contain" the same instance? I confess that I am having some difficulty imagining such a scenario in the real world.</description>
		<content:encoded><![CDATA[<p>Here, $a and $b are not the same instance of an object, they are two different instance of the same class, eventhough the if statement will return true&#8230;</p>
<p>Ok, I see your point there, but without simply stating that $a=$b; can you provide a simple example wherein $a and $b would in fact be &#8220;the same instance of an object&#8221; never mind where $a and $b &#8220;contain&#8221; the same instance? I confess that I am having some difficulty imagining such a scenario in the real world.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1447</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 05 Oct 2008 06:30:16 +0000</pubDate>
		<guid isPermaLink="false">http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1447</guid>
		<description>Yeah, from the manual, it says instanceof can also used with another object or a string variable. However, look at the example#5 on php.net, the use of another object example is:
$a = new MyClass;
$b =new MyClass;
if($a instanceof $b)...

Here, $a and $b are not the same instance of an object, they are two different instance of the same class, eventhough the if statement will return true.</description>
		<content:encoded><![CDATA[<p>Yeah, from the manual, it says instanceof can also used with another object or a string variable. However, look at the example#5 on php.net, the use of another object example is:<br />
$a = new MyClass;<br />
$b =new MyClass;<br />
if($a instanceof $b)&#8230;</p>
<p>Here, $a and $b are not the same instance of an object, they are two different instance of the same class, eventhough the if statement will return true.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tjmcd1963</title>
		<link>http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1444</link>
		<dc:creator>tjmcd1963</dc:creator>
		<pubDate>Sat, 04 Oct 2008 16:24:59 +0000</pubDate>
		<guid isPermaLink="false">http://readtheweb.info/2008/01/24/zend-php5-certification-exam-study-review-11-supplementary-ii/#comment-1444</guid>
		<description>When checking to see if two variables contain the same instance of an object, which of the following comparisons should be used? 
  if($obj1 === $obj2)  // ??? are you sure it's not...
if($obj1 instanceof $obj2) // ???
e.g. (from the manual)...
"Although instanceof is usually used with a literal classname, it can also be used with another object or a string variable:"


if($a instanceof $b) echo "foo";
if($a === $b) echo "bar";
//returns foo</description>
		<content:encoded><![CDATA[<p>When checking to see if two variables contain the same instance of an object, which of the following comparisons should be used?<br />
  if($obj1 === $obj2)  // ??? are you sure it&#8217;s not&#8230;<br />
if($obj1 instanceof $obj2) // ???<br />
e.g. (from the manual)&#8230;<br />
&#8220;Although instanceof is usually used with a literal classname, it can also be used with another object or a string variable:&#8221;</p>
<p>if($a instanceof $b) echo &#8220;foo&#8221;;<br />
if($a === $b) echo &#8220;bar&#8221;;<br />
//returns foo</p>
]]></content:encoded>
	</item>
</channel>
</rss>
