Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.

Commit b6365b9

Browse files
Merge pull request #142 from coz-git/master
Create factorial_PHP
2 parents 7260913 + a7e63c8 commit b6365b9

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

php/coz-get_factorial.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
$n = $_POST['input'];
3+
$x = 1;
4+
for($i=1;$i<=$n-1;$i++) {
5+
$x*=($i+1);
6+
}
7+
?>
8+
9+
<?php if(!empty($x)) : ?>
10+
<div class="col-md-8">
11+
<h4>Faktor : <?= $x ?></h4>
12+
</div>
13+
<?php endif ?>

php/coz-git_vocal.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
if($_POST) {
3+
$input = $_POST['text'];
4+
$text = strtolower(str_replace(' ', '', $input));
5+
$converArray = str_split($text);
6+
7+
foreach ($converArray as $row => $value) {
8+
if(preg_match('/^[aiueo]/', $value)) {
9+
$vokal[] = $value;
10+
sort($vokal);
11+
} else {
12+
$konsonan[] = $value;
13+
sort($konsonan);
14+
}
15+
}
16+
}
17+
?>
18+
19+
<?php if(!empty($vokal)) : ?>
20+
<div class="col-md-8">
21+
<h4>Huruf Vokal : <?= implode($vokal) ?></h4>
22+
<h4>Huruf Non Vokal : <?= implode($konsonan) ?></h4>
23+
</div>
24+
<?php endif ?>

0 commit comments

Comments
 (0)