PHP array join

This section illustrates the use of the join function in php

 
 

Share on Google+Share on Google+

PHP array join

Ads

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

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