Skip to content

Instantly share code, notes, and snippets.

@Aziz-Rahman
Created December 8, 2015 07:13
Show Gist options
  • Save Aziz-Rahman/7c0a48d720025d55b30a to your computer and use it in GitHub Desktop.
Save Aziz-Rahman/7c0a48d720025d55b30a to your computer and use it in GitHub Desktop.
Memisahkan kata dengan koma
<?php
// 1.
$text = '#ccc#ddd#fff'; // output awal
$data = str_replace ("#", ",#", $text);
$str = trim($data,',');
echo $str;
echo '<br>';
// 2.
$test2 = array( '#ccc', '#ddd', '#fff' ); // output awal dg array
$result2 = implode( ',', $test2 );
echo $result2;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment