KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I wonder how can I rename an object property in PHP, e.g.: <?php $obj = new stdclass(); $obj->a = 10; // will be renamed $obj->b = $obj->a; // rename "a" to "b", somehow! unset($obj->a); // remove the original one It does not work in PHP5.3, (donno about earlier versions) since there will be a reference of $obj->a assigned to $obj->b and so by unsetting $obj->a , the value of $obj->b will be null. Any ideas please?
Tags (comma-separated)
Save Edits
Cancel