Home Tutorial Php Phparray PHP array as string

 
 

PHP array as string
Posted on: October 27, 2009 at 12:00 AM
This section demonstrates Learn the PHP Array as String as well as how to use implode() php function.

  • implode () function joins the array elements into a single string variable.


Example of PHP Array as String

<?php

$ar1=array("apple","banana","tomato","potato");

echo $ar1;

echo "<br>size is ".sizeof($ar1);

$a=implode(",",$ar1);

echo "<br>".$a;

echo "<br> size is ".sizeof($a);

?>

Output

Array
size is 4
apple,banana,tomato,potato
size is 1

Related Tags for PHP array as string:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.