echo "belajar explode";
echo '<br >';
$to = '26-07-2016';
echo $to;
echo '<br />';
$to = explode(" ",$to);
$tgl = explode("-",$to[0]);
if(!empty($to[1])) $to = $tgl[2]."-".$tgl[1]."-".$tgl[0]." ".$to[1];
else $to = $tgl[2]."-".$tgl[1]."-".$tgl[0];
echo $to;
$to1 = '26-07-2016';
$to = explode("-",$to1);
echo '<br />';
echo '<pre>';
print_r($to);
echo '</pre>';
echo '<hr>';
echo "belajar implode";
echo '<br />';
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr)."<br>";
echo implode("+",$arr)."<br>";
echo implode("-",$arr)."<br>";
echo implode("X",$arr);
echo'<hr>';
echo "belajar split";
echo '<br >';
$to2 = '26-07-2017';
echo $to2;
echo '<br />';
$to2 = split(" ",$to2);
$tgl = split("-",$to2[0]);
if(!empty($to[1])) $to2 = $tgl[2]."-".$tgl[1]."-".$tgl[0]." ".$to2[1];
else $to = $tgl[2]."-".$tgl[1]."-".$tgl[0];
echo $to2;
$to3 = '26-07-2017';
$to4 = split("-",$to3);
echo '<br />';
echo '<pre>';
print_r($to4);
echo '</pre>';
?>
======================================
hasil nya localhost
======================================
belajar explode
26-07-2016
2016-07-26
Array ( [0] => 26 [1] => 07 [2] => 2016 )
belajar implode
Hello World! Beautiful Day!
Hello+World!+Beautiful+Day!
Hello-World!-Beautiful-Day!
HelloXWorld!XBeautifulXDay!
belajar split
26-07-2017
2017-07-26
Array ( [0] => 26 [1] => 07 [2] => 2017 )
0 Response to "belajar tutorial explode implode split"
Posting Komentar