forked from faisal2410/php_projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp_basic_project.php
More file actions
35 lines (32 loc) · 1.04 KB
/
Copy pathphp_basic_project.php
File metadata and controls
35 lines (32 loc) · 1.04 KB
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
<!DOCTYPE html>
<html>
<head>
<title>PHP Basic Functions Project</title>
</head>
<body>
<h1>PHP Basic Functions Project</h1>
<?php
// Array Functions
$numbers = array(2, 5, 3, 8, 1, 7, 9, 4, 6);
echo "<h2>Array Functions</h2>";
echo "<p>Array: " . implode(", ", $numbers) . "</p>";
echo "<p>Max Value: " . max($numbers) . "</p>";
echo "<p>Min Value: " . min($numbers) . "</p>";
echo "<p>Reversed Array: " . implode(", ", array_reverse($numbers)) . "</p>";
// Math Functions
$number = 7;
echo "<h2>Math Functions</h2>";
echo "<p>Number: " . $number . "</p>";
echo "<p>Square Root: " . sqrt($number) . "</p>";
echo "<p>Power of 2: " . pow($number, 2) . "</p>";
echo "<p>Absolute Value: " . abs(-$number) . "</p>";
// String Functions
$text = "This is a sample text";
echo "<h2>String Functions</h2>";
echo "<p>Text: " . $text . "</p>";
echo "<p>Uppercase: " . strtoupper($text) . "</p>";
echo "<p>Lowercase: " . strtolower($text) . "</p>";
echo "<p>Word Count: " . str_word_count($text) . "</p>";
?>
</body>
</html>