Share on Google+Share on Google+

PHP array join

Advertisement
This section illustrates the use of the join function in php

  • Join function add all the elements of the given array into a single string variable.
  • It woks similar to implode function.
  • It is the alias of the implode function.


PHP Array Join() Example

<?php
$myarray
=array("c"=>"cpu","m"=>"monitor","m1"=>"mouse","k"=>"keyboard","joystick");
print_r($myarray);
$array1
=join($myarray);
echo
"<br>";
print_r($array1);
?>

Output
Array ( [c] => cpu [m] => monitor [m1] => mouse [k] => keyboard [0] => joystick )
cpumonitormousekeyboardjoystick

Advertisements

Advertisement

Posted on: October 28, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.