本文整理汇总了PHP中Guest::setIndianPhoneNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Guest::setIndianPhoneNumber方法的具体用法?PHP Guest::setIndianPhoneNumber怎么用?PHP Guest::setIndianPhoneNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guest
的用法示例。
在下文中一共展示了Guest::setIndianPhoneNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setIndianPhoneNumber
class Guest extends Person
{
public $indianPhoneNumber = "";
function setIndianPhoneNumber($phoneNumber)
{
if (isPhoneNumber($phoneNumber . '0')) {
$this->indianPhoneNumber = $phoneNumber;
} else {
echo "Please provide valid Phone Number", "<br>";
}
}
}
$indian = new Guest();
$indian->name = "Daniel";
$indian->email = "soumenseth@gmail.com";
$indian->setIndianPhoneNumber("8008900910");
$indian->setPhoneNumber("80089009101");
echo $indian->name, "<br>";
echo $indian->email, "<br>";
echo $indian->phoneNumber, "<br>";
echo $indian->indianPhoneNumber, "<br>";
$person = new Person();
$person->setIndianPhoneNumber("01769757222");
class MyString
{
public $value = "initial value";
function myStrLen()
{
return strlen($this->value);
}
function print_string()
示例2: setPhoneNumber
function setPhoneNumber($phoneNumber)
{
if (isBdphoneNumber($phoneNumber)) {
$this->phoneNumber = $phoneNumber;
} else {
echo "Please provide a valid number.";
}
}
}
//Inheritence code
class Guest extends person
{
public $IndianPhoneNumber = "";
function setIndianPhoneNumber($phoneNumber)
{
if (isBdphoneNumber($phoneNumber . '0')) {
$this->IndianPhoneNumber = $phoneNumber;
} else {
echo "Please provide a valid number.";
}
}
}
$person1 = new Person();
$person1->setPhoneNumber("01680583924");
echo $person1->phoneNumber . "<br>";
$guest = new Guest();
$guest->setIndianPhoneNumber("8008900910");
echo $guest->IndianPhoneNumber . "<br>";
echo $guest->name . "<br>";
echo $guest->email . "<br>";
echo $guest->phoneNumber . "<br>";