-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra.php
62 lines (56 loc) · 1.36 KB
/
extra.php
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
<?php
// (A) CREATE NEW DATE TIME OBJECT
$dt = new DateTime("2019-08-14");
echo "ORIGINAL DATE: " . $dt->format("d M Y") . "<br>";
// (B) ADD DAYS WEEKS MONTHS
$dt->modify("+4 days");
echo "+4 DAYS: " . $dt->format("d M Y") . "<br>";
$dt->modify("+2 weeks");
echo "+2 WEEKS: " . $dt->format("d M Y") . "<br>";
$dt->modify("+1 month");
echo "+1 MONTH: " . $dt->format("d M Y") . "<br>";
$dt->modify("+4 year");
echo "+4 year: " . $dt->format("d M Y") . "<br>";
// (C) SUBTRACT DAYS WEEKS MONTHS
$dt->modify("-2 days");
echo "-2 DAYS: " . $dt->format("d M Y") . "<br>";
$dt->modify("-1 week");
echo "-1 WEEK: " . $dt->format("d M Y") . "<br>";
$dt->modify("-2 months");
echo "-2 MONTHS: " . $dt->format("d M Y") . "<br>";
////////////////////////////////
$string = "Hello India";
print_r(str_split($string));
?><br>
<?php
////////////////////////////////
$url = "aas33.11";
$fullArray = explode('.', $url);
print_r($fullArray);
?><br>
<?php
print_r($fullArray[0]);
?><br>
<?php
print_r($fullArray[1]);
?><br>
<?php
$v = $fullArray[1];
echo $v;
?><br>
<?php
$var = 2.29;
echo $var2 = strval($var); // '2.29'
?><br>
<?php
echo $var3 = intval($var); // 2
?><br>
<?php
echo $var4 = boolval($var); // true
?><br>
<?php
echo $var5 = floatval($var); // 2.29
?><br>
<?php
//Converts the $var type
echo $d = settype($var, 'string');