-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp2.php
More file actions
executable file
·36 lines (32 loc) · 841 Bytes
/
php2.php
File metadata and controls
executable file
·36 lines (32 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<body>
<!-- MADE BY CHETAN KHANNA -->
<!-- ROLL NUMBER : 2018CSC10143 -->
<!-- SEM IV -->
<h3>Check if a given string is an anagram of another given string</h3>
<?php
function anagram()
{
$s1 = $_POST['text1'];
$s2 = $_POST['text2'];
if (count_chars($s1, 1) == count_chars($s2, 1)) {
echo "YES , " . $s1 . " is an anagram of " . $s2;
} else {
echo "NO , " . $s1 . " is not an anagram of " . $s2;
}
}
if (isset($_POST['submit'])) {
anagram();
} else {
?>
<form action="" method="post">
String 1 : <input type="text" name="text1" required><br><br>
String 2 : <input type="text" name="text2" required><br><br>
<span>      </span>
<input type="submit" value="Submit" name="submit">
</form>
<?php
}
?>
</body>
</html>