Jump to: navigation, search

Php join

From w3cyberlearnings

Contents

PHP function join

This function returns a string join by separator from the array element. This function is an alias of the implode() function.

Syntax join

  • separator: string separator
  • array: array input
join(separator,array);

Example 1

<?php
$role= array('cfo', 'ceo', 'leader');
echo join('-',$role);
?>

Output

cfo-ceo-leader

Example 2

<?php

$arr = array('JOHN', 'BOBMAAT', 'BILL CLIN', 'GORGE BUS');

$all_join_str = join(' ',$arr);

echo $all_join_str;

?>

Output

JOHN BOBMAAT BILL CLIN GORGE BUS

Related Functions


Navigation
Web
SQL
MISC
References