当前位置: 首页>>代码示例>>PHP>>正文


PHP Guest::setIndianPhoneNumber方法代码示例

本文整理汇总了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()
开发者ID:shamanurrahman,项目名称:attempt,代码行数:31,代码来源:class.php

示例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>";
开发者ID:majumder5niru,项目名称:Learning_PHP,代码行数:31,代码来源:first_oop_problem.php


注:本文中的Guest::setIndianPhoneNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。