I have a PHP array and want to convert it to a string.
I know I can use join or implode, but in my case array has only one item. Why do I
join
implode
A simple way to create a array to a PHP string array is:
<?PHP $array = array("firstname"=>"John", "lastname"=>"doe"); $json = json_encode($array); $phpStringArray = str_replace(array("{", "}", ":"), array("array(", "}", "=>"), $json); echo phpStringArray; ?>