alanchai Posted April 6, 2006 Share Posted April 6, 2006 Hi,Newbies here. I have a string variable $AR which has values of this are text string---> array (array ("","A", "B"), array ("X",1,2) array ("Y", 3, 4))How can I push this string to an array say $code['var'] so that it takes the array format??I tried the following, but it doesn't work.$code['var'] = $AR;$code['var'] becomes a string after the assignment.I tried using var_dump and var_export, can't get the result I am expecting. Perhaps I am going the wrong direction. Any advise? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 6, 2006 Share Posted April 6, 2006 Is this what you're trying to do?[code]<?php$ar = '$arr = array (array ("","A", "B"), array ("X",1,2), array ("Y", 3, 4));';echo $ar."<br>\n";eval($ar);echo '<pre>' . print_r($arr,true) . '</pre>';?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.