How can i convert this string
$str = "array('3'=>'wwm','1'=>'wom')";
to real php associative array...
How can i convert this string
$str = "array('3'=>'wwm','1'=>'wom')";
to real php associative array...
It's simple but REALLY INSECURE
$str = "array('3'=>'www.tension.com','1'=>'www.seomeuo.com','requestedBy'=>'1')";
eval("\$array = $str;");
You never should use this approach, there another ways to do it like: serialize() and unserialize()
;. Note that the ; is essentialFirst of all. Do not use eval. It is Evil! http://af-design.com/blog/2010/10/20/phps-eval-is-evil/
Secondly. The simple solution would not to be using this string but simply to use "serialize" when you put it in the DB and unserialize when you pull it out. You are storing a very unusual format.