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


PHP person::set_name方法代码示例

本文整理汇总了PHP中person::set_name方法的典型用法代码示例。如果您正苦于以下问题:PHP person::set_name方法的具体用法?PHP person::set_name怎么用?PHP person::set_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在person的用法示例。


在下文中一共展示了person::set_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: person

<?php 
include "class_person.php";
?>
<html>
<head>
<title>PHP Class Implementation</title>
</head>

<body>

<?php 
$ram = new person("Ram Krishna Maharjan");
$shyam = new person("Shayam Prashad Karki");
$ram->set_name("Ram Kumar Maharjan");
$shyam->set_name("Shyam Karki");
print "Ram's full name: " . $ram->get_name();
print "<br>Shyam's full name: " . $shyam->get_name();
?>

<?php 
//print "<h2>Private Attribute testing</h2>";
//print "Tell me private stuff: " . $ram->pinn_number; //throws an error
$ram->set_pinn_number("1234-5423-9873");
print "<br><br>Showing Private variable: " . $ram->get_pinn_number();
?>

</body>
</html>
开发者ID:kurtkesu,项目名称:PHP-MYSQL-Class-Basic,代码行数:28,代码来源:person_instance.php

示例2: set_name

 function set_name($new_name)
 {
     //$this->name=strtoupper($new_name);
     person::set_name($new_name);
     //static access use double colon sign (::)
     parent::set_name($new_name);
     //static access can access class from parent class 1 level
 }
开发者ID:jojo48,项目名称:a1,代码行数:8,代码来源:class_lib.php

示例3: set_name

 protected function set_name($new_name)
 {
     if ($new_name == "Stefan Sucks") {
         $this->name = $new_name;
     } else {
         if ($new_name == "Johnny Fingers") {
             person::set_name($new_name);
         }
     }
 }
开发者ID:analyn34,项目名称:oop-php,代码行数:10,代码来源:class_lib.php

示例4: person

 <head>
     <meta charset="UTF-8">
     <title>OOP in PHP</title>

     <?php 
//Include your class in your main PHP page
include "class.php";
?>






     </head>

 <body>
 <?php 
//To create an object out of a class, you need to use the 'new' keyword.
$stephan = new person();
$jimmy = new person();
// Set an objects properties
$stephan->set_name("Stephan Mcgregory");
$jimmy->set_name("Jimmy Wanjala");
//Accessing an object's data using ->
echo "Stephans full name is " . $stephan->get_name();
echo "Jimmy's full name is" . $jimmy->get_name();
?>
 </body>
 </html>
开发者ID:easyguyme,项目名称:LEARN-OBJECT-ORIENTED-PROGRAMMING-OOP-IN-PHP,代码行数:30,代码来源:index.php

示例5: person

<?php

include "class_lib.php";
$stefan = new person('bob');
$stefan->set_name("Stefan Mischook");
$jimmy = new person('nick jimmy');
echo "Stefan's full name: " . $stefan->get_name();
echo "Nick's full name: " . $jimmy->get_name();
// $stefan = new person("Stefan Mischook");
$stefan->pinn_number;
开发者ID:marcfeather,项目名称:EveTradeMaster,代码行数:10,代码来源:index.php


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