Does PHP closing tag destructs an instantiated class (object)?

jackrose

New Member
\[code\]<?php class Student { public $name = "Benjamin"; } $name = new Student();?><p>Hello, there. My name is <?php $name->name ?></p>\[/code\]The above code doesn't work as intended (printing the name within "p" tags). But the below code, of course, does work:\[code\]<?phpclass Student { public $name = "Benjamin"; }$name = new Student();echo '<p>Hello, there. My name is ' . $name->name . '</p>';?>\[/code\]Is the class being destructed when closing PHP tags?Is there a work-around for the second code example?Thanks, as always.
 
Back
Top