Php passing the same objects on another file
<p>1) Suppose I have 2 php files: <strong>fileA.php</strong>, and <strong>fileB.php</strong>
And I have 1 class file: <strong>myClassFile.php</strong></p>

<p>in <strong>fileA.php</strong>, I need to instantiate a <code>MyClass</code> class in <strong>myClassFile.php</strong>:</p>

<pre><code>...
myObject = new MyClass();
...
</code></pre>

<p>in <strong>fileB.php</strong>, I need to use the <code>myObject</code> object created in <strong>fileA.php</strong>.</p>

<p>How would I do that? Is using sessions the way to go?</p>

<pre><code>$_SESSION["my_object"] = myObject;
</code></pre>

<p>or are there better ways? Specifically, how will it be implemented?</p>

<p>2) Suppose I don't use solutions similar to the above.. Will <code>myObject</code> in <strong>fileA.php</strong> be lost (destroyed, or freed) when the user proceeds to <strong>fileB.php</strong>? That is, will there be no more reference to <code>myObject</code> in <strong>fileB.php</strong>? </p>
