I'm trying to get a simple example to work but its not working. What the example does is copy the variables from a class into an object were values are assigned to it.
When executing the script located at: http://devel.webc0der.net/object_copying.php
I get the error message:
Parse error: parse error, expecting `T_STRING' in /web/sites/128/webc0der/www.webc0der.f2s.com/devel/object_copying.php on line 20
Here is the entire code:
<?
class my_class
{
var $var1, $var2, $var3;
}
$my_object = new my_class;
$my_object->var1 = 1;
$my_object->var2 = 2;
$my_object->var3 = 3;
$new_object = $my_object;
$new_object->var1 = 3;
$new_object->var2 = 2;
$new_object->var3 = 1;
print("My object goes $my_object->1, $my_object->var2, $my_object->var3 !<br>")
print("New object goes $new_object->var1, $new_object->var2, $new_object->var3 !<br>")
?>