Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function pertaman($kata) {
- $sim = '-';
- $str = explode(' ', $kata);
- $initials = $str[0];
- if ($initials[0] == $sim) {
- $hasil = $initials[1];
- }
- else{
- $hasil = $initials[0];
- }
- return $hasil;
- }
- echo pertaman('-dunia ini sangat indah');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement