note 80720 added to function.unserialize

From: Date: Wed, 30 Jan 2008 01:44:41 +0000
Subject: note 80720 added to function.unserialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-135576@lists.php.net to get a copy of this message
Problem: I needed a way to call an object that I did not know the name of. This forced me to use a variable for the class name. Solution: unserialize(); GACK! This is imaginative, but horrid. Firstly, I thought this would work: $object=new $class_name(); Otherwise, something like below will work: $object=eval("new $class_name()"); You can use a normal constructor this way too. ---- Server IP: 194.145.210.3 Probable Submitter: 131.111.236.124 ---- Manual Page -- http://www.php.net/manual/en/function.unserialize.php Edit -- https://master.php.net/note/edit/80720 Del: integrated -- https://master.php.net/note/delete/80720/integrated Del: useless -- https://master.php.net/note/delete/80720/useless Del: bad code -- https://master.php.net/note/delete/80720/bad+code Del: spam -- https://master.php.net/note/delete/80720/spam Del: non-english -- https://master.php.net/note/delete/80720/non-english Del: in docs -- https://master.php.net/note/delete/80720/in+docs Del: other reasons-- https://master.php.net/note/delete/80720 Reject -- https://master.php.net/note/reject/80720 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135576) next »