-
Notifications
You must be signed in to change notification settings - Fork 0
/
class1.php
60 lines (53 loc) · 1.03 KB
/
class1.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
<!DOCTYPE HTML>
<html>
<?php
include'C:/xampp/htdocs/training/php/my_function/strlen.php';
if(isset($_GET['phonenumber']))
{
$phonenumber=($_GET['phonenumber']);
}
//blueprint
class person
{
//declare class property/value
public $name="PHP";
public $email="php.net";
public $phonenumber="90XXXXXX90";
}
function isBdphonenumber($phonenumber)
{
$length = strlen($phonenumber);
if($length == 11)
{
for($i=0;$i<$length;$i++)
{
if($phonenumber[$i]<'0'|| $phonenumber[$i]>'11')
{
return false;
}
}
return true;
}
else
{
return false;
}
}
echo isBdphonenumber('');
//creating object
$person1 = new person;
$person1->name="HTML";
echo $person1->name,"<br>";
/*
$person2 = new person;
echo $person2->name;
$person->setphonenumber("01834063413");
echo $person1->phonenumber;*/
?>
<body>
<form action="class1.php" method="get">
Phone number:<input type="number" name="phonenumber"/>
<button type="submit" name="submit">Click</button>
</form>
</body>
</html>