PHP array join


 

PHP array join

This section illustrates the use of the join function in php

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

Ads