Possible Duplicate:
Convert PHP array string into an array
Which function can be used to convert an array into a string ,maintaining your ability to return the string into an array
Possible Duplicate:
Convert PHP array string into an array
Which function can be used to convert an array into a string ,maintaining your ability to return the string into an array
You can use the implode function to convert an array into a string:
$array = implode(" ", $string); //space as glue
If you want to convert it back to an array you can use the explode function:
$string = explode(" ", $array); //space as delimiter
function makestring($array)
  {
  $outval = '';
  foreach($array as $key=>$value)
    {
    if(is_array($value))
      {
      $outval .= makestring($value);
      }
    else
      {
      $outval .= $value;
      }
    }
  return $outval;
  }
Just to add, there's also the var_export function. I've found this useful for certain situations. From the manual:
var_export — Outputs or returns a parsable string representation of a variable
Example:
<?php
$a = array (1, 2, array ("a", "b", "c"));
var_export($a);
?>
Returns this output (which can then be converted back to an array using eval()):
array (
  0 => 1,
  1 => 2,
  2 => 
  array (
    0 => 'a',
    1 => 'b',
    2 => 'c',
  ),
)