-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInbuiltNumericAndArrayFunctions.php
More file actions
78 lines (62 loc) · 1.48 KB
/
InbuiltNumericAndArrayFunctions.php
File metadata and controls
78 lines (62 loc) · 1.48 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
//size of an array
$sports=array("cricket","football","volleyball","hockey");
echo sizeof($sports);
echo "<br>";
list($a,$b,$c,$d)=$sports;
echo "My favourite sports are: $a,$b,$c, and $d";
echo "<br>";
//sum of the integer in an array
$num=array(200,300,100,400);
echo array_sum($num);
echo "<br><br>";
//to return the highest value from the array
echo max(20,23,24,25);
echo "<br>";
//to return the smallest value from the array
echo min(23,22,25,26);
echo "<br>";
echo min(array(4,5,3,6));
echo "<br>";
//to return the absolute positive value
echo abs(-9.8);
echo "<br>";
//to convert to binary from decimal
echo bindec(10011);
echo "<br>";
//to convert to decimal to binary
echo decbin(24);
echo "<br>";
//to round up a number to the nearest integer
echo ceil(0.34);
echo "<br>";
echo ceil(-9.8);
echo "<br>";
//to round down a number to the nearest integer
echo floor(0.34);
echo "<br>";
echo floor(-6.7);
echo "<br>";
//to return the value of PI
echo pi();
echo "<br>";
//to return the power value
echo pow(3, 4); //it gives the value to 3^4
echo "<br>";
//to show the current date
echo date("m/d/y");
echo "<br>";
echo date("F j,Y");
echo "<br>";
//to show the standard time
echo "the time is".date("h:i:s A");
echo "<br>";
//to show standard date in word and time
echo date("Y-M-D h:i:s");
echo "<br>";
//to show standard date and time in number
echo date("y-m-d h:i:s");
echo "<br>";
//to show the default time zone
date_default_timezone_set("Asia/kathmandu");
echo date("h:i:s A");