PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I turn an array into a string?


If you explode to go one way, then you implode to come back the other way (or use join if you want to type less characters).

Just use the delimiter as the first argument and the array as the second.

Here we go:

<?php
$myarray 
= array("I","love","washing","up");
$mystring implode(" "$myarray);
echo 
"$mystring";//I love washing up
?>



More arrays PHP Questions

How do I return all the values in an array?
How do I reverse sort an array by key?
How do I count the number of times a value appears in an array?
How do I add to the beginning of an array and find the number of elements in it?
How can I reverse sort an array keeping the correlation between the index and value?