Jump to content


var_dump ? var_export?

  • Please log in to reply
1 reply to this topic

#1 alanchai

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 April 2006 - 02:00 PM


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?

#2 kenrbnsn

  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 06 April 2006 - 05:42 PM

Is this what you're trying to do?
$ar = '$arr = array (array ("","A", "B"), array ("X",1,2), array ("Y", 3, 4));';
echo $ar."<br>\n";
echo '<pre>' . print_r($arr,true) . '</pre>';


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users