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


PHP Animal::changeHealth方法代码示例

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


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

示例1: __autoload

<?php

/*   Load in classes     */
function __autoload($className)
{
    require 'classes/' . $className . '.php';
}
/*   Create instance of class Animal: $cat = new Animal("Name", "Gender","health");   */
$cat = new Animal("Buttons", "Male", 50);
$hippo = new Animal("Ms Hippo", "Female", 1000);
$flamingo = new Animal("Firenze", "Male", 200);
$hippo->changeHealth(-200);
/*  Create instance of class lion & zebra  */
$Lionel = new Lion("Lionel", "Male", 500, "Cool lion");
$Lionesse = new Lion("Lionesse", "Female", 400, "Awesome lion");
$Zebradude = new Zebra("Zebradude", "Male", 500, "Fast zebra");
$Zebradudette = new Zebra("Zebradudette", "Female", 300, "Good looking zebra");
?>

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Opdracht classes: extends</title>
        <link rel="stylesheet" href="http://web-backend.local/css/global.css">
        <link rel="stylesheet" href="http://web-backend.local/css/facade.css">
        <link rel="stylesheet" href="http://web-backend.local/css/directory.css">
    </head>
    <body class="web-backend-opdracht">
        
开发者ID:RobinDeHerdt,项目名称:web-backend-oplossingen,代码行数:30,代码来源:application.php

示例2: __autoload

<?php

function __autoload($className)
{
    require_once $className . '-class.php';
}
// ANIMAL CLASS
$kikker = new Animal('Kermit', 'male', 100);
$kat = new Animal('Dikkie', 'male', 100);
$kat->changeHealth(-10);
$dolfijn = new Animal('Flipper', 'female', 80);
?>


<!DOCTYPE html>
<html>
<head>
	<title>Oplossing PHPoefening 040</title>
</head>
	<body>
	

		<h1>Oplossing PHPoefening 040</h1>
		
		
		<p><?php 
echo $kikker->getName();
?>
 is van het geslacht <?php 
echo $kikker->getSex();
?>
开发者ID:gurbuzhasan,项目名称:web-backend,代码行数:31,代码来源:phpoefening-040-a-oplossing.php

示例3: __autoload

<!doctype html>

<?php 
function __autoload($className)
{
    require_once 'classes/' . $className . '.php';
}
// ANIMAL CLASS
$rat = new Animal('Lou', 'male', 100);
$kat = new Animal('Dik', 'female', 100);
$koe = new Animal('Mia', 'female', 80);
$kat->changeHealth(-10);
$koe->changeHealth(+5);
// LION CLASS
$simba = new lion('Simba', 'male', 100, 'Congo lion');
$scar = new lion('Scar', 'female', 100, 'Kenia lion');
// ZEBRA CLASS
$zeke = new zebra('Zeke', 'male', 120, 'Quagga');
$zana = new zebra('Zana', 'female', 100, 'Selous');
?>

<html>
<head>
<meta charset="utf-8">
<title>Naamloos document</title>
</head>

<body>

<h1>Opdracht classes extends</h1>
开发者ID:stoicsteve,项目名称:web-backend-oplossingen,代码行数:30,代码来源:application.php

示例4: __autoload

function __autoload($className)
{
    include "classes/" . $className . ".php";
}
/*
__autoload("Animal");
__autoload("Lion");*/
$lion = new Animal("johan", "man", 10);
$cat = new Animal("bert", "vrouw", 50);
$dog = new Animal("Gerrit", "man", 24);
$simba = new Lion("lion", "Simba", "vrouw", 12);
$scar = new Lion("mountain lion", "scar", "man", 150);
$zeke = new Zebra("Leke", "man", 57421, "zebra");
$Brian = new Zebra("Bian", "vrouw", 5742, "zebra");
$lion->changeHealth(20);
?>

<!doctype html>
<html>
	<head>
		<title>Opdracht classes-extends</title>

	</head>

<body>

	<h1>Instanties van de classe Animal</h1>

	<p><?php 
echo $lion->getName();
开发者ID:sepperenty,项目名称:web-backend-oplossingen,代码行数:30,代码来源:application.php

示例5: __autoload

<?php

function __autoload($classname)
{
    //__autoload load automatisch alle classes in
    include 'classes/' . $classname . '.php';
}
$lion = new Animal('wout', 'male', 100);
$tiger = new Animal('tiger', 'female', 80);
$bear = new Animal('bear', 'male', 150);
$simba = new Lion('Congo lion', 'simba', 50, 'female');
$scar = new Lion('Kenia lion', 'scar', 70, 'female');
$zeke = new Zebra('zeke', 'male', 20, 'Quagga');
$zana = new Zebra('zana ', 'female', 20, 'Selous');
$lion->changeHealth(150);
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<h1>Opdracht classes extends</h1>
	
	<h3>Instanties van de classe Animal</h3>
	<p><?php 
echo $lion->getName();
?>
 is van het geslacht <?php 
开发者ID:Verhoevenwout,项目名称:web-backend-oplossingen,代码行数:31,代码来源:application.php

示例6: __autoload

<?php

function __autoload($className)
{
    include 'classes/' . $className . '.php';
}
//Deel1 animals
$Mens1 = new Animal('Edward', 'Man', 100);
$Mens2 = new Animal('Zoë', 'Vrouw', 100);
$Beer = new Animal('Winnie the pooh', 'Man', 100);
$Mens1->changeHealth(-30);
$Mens2->changeHealth(30);
$Beer->changeHealth(20);
//Deel2 leeuwen
$leeuw1 = new Lion("geertrude", "Vrouw", 100, "Congo lion");
$leeuw2 = new Lion("geertjan", "Man", 100, "africa lion");
//Deel3 Zebras
$zebra1 = new Zebra("Jozef", "Man", 100, "dappere zebra");
$zebra2 = new Zebra("Maria", "Vrouw", 100, "zwangere zebra");
?>


 <!DOCTYPE html>
 <html>
   <head>
     <meta charset="utf-8">
     <title>dieren paradijs</title>
   </head>
   <body>
      <div>
        <h2>Dieren</h2>
开发者ID:edwwaarrdd,项目名称:web-backend-oplossingen,代码行数:31,代码来源:oplossing.php

示例7: __autoload

<?php

function __autoload($class)
{
    include $class . "s.php";
}
$tijger = new Animal("tijgertje", "female", 1000);
$flamingo = new Animal("pinky", "male", 420);
$kat = new Animal("miauw zedong", "male", 9999);
$tijger->changeHealth(50);
$kat->doSpecialMove();
$simba = new Lion("Simba", "male", 100, "Congo lion");
$zeke = new Zebra("zeke", "male", 420, "Quagga");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Classes extends</title>
</head>
<body>
    <h1>Oplossing classes-extends</h1>
    <p><?php 
echo $tijger->getName();
?>
 is van het geslacht <?php 
echo $tijger->getGender();
?>
 en heeft <?php 
echo $tijger->getHealth();
?>
开发者ID:rubends,项目名称:web-backend-oplossingen,代码行数:31,代码来源:oplossing-classes-extends.php

示例8:

?>
 levenspunten</p>
	<p><?php 
echo $flipper->getName();
?>
 is van het geslacht <?php 
echo $flipper->getGender();
?>
 en heeft momenteel <?php 
echo $flipper->getHealth();
?>
 levenspunten</p>

	<?php 
$kermit->changeHealth(-30);
$flipper->changeHealth(15);
?>

	<p><?php 
echo $kermit->getName();
?>
 wordt aangevallen, hij heeft nu <?php 
echo $kermit->getHealth();
?>
 levenspunten</p>
	<p><?php 
echo $flipper->getName();
?>
 gebruikt <?php 
echo $flipper->doSpecialMove();
?>
开发者ID:didierdemaeyer,项目名称:web-backend-oplossingen,代码行数:31,代码来源:application.php

示例9: __autoload

<?php

function __autoload($className)
{
    require_once 'classes/' . $className . '.php';
}
$leeuw = new Animal('Joerie', 'male', 100);
$slak = new Animal('Gerath', 'ander', 50);
$aap = new Animal('Barry', 'female', 80);
$leeuw->changeHealth(-20);
$slak->changeHealth(20);
$aap->changeHealth(10);
$leeuw1 = new Lion('Simba', 'ander', 50, 'Congo Lion');
$leeuw2 = new Lion('Scar', 'female', 80, 'Kenia Lion');
$zebra1 = new Zebra('Zeke', 'ander', 50, 'Congo Zebra');
$zebra2 = new Zebra('Zana', 'female', 80, 'Kenia Zebra');
?>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Opdracht classes: extends</title>
    <link rel="stylesheet" href="http://web-backend.local/css/global.css">
    <link rel="stylesheet" href="http://web-backend.local/css/facade.css">
    <link rel="stylesheet" href="http://web-backend.local/css/directory.css">
</head>

<body class="web-backend-voorbeeld">
开发者ID:arnevanbavel,项目名称:web-backend-2015-2016,代码行数:30,代码来源:opdracht-classes-extends.php

示例10: __autoload

<?php

function __autoload($className)
{
    include 'classes/' . $className . '.php';
}
$hond = new Animal('Fifi', 'male', 50);
$kat = new Animal('Sylvester', 'female', 40);
$lynx = new Animal('Willy', 'male', 60);
$lynx->changeHealth(-25);
$kat->changeHealth(10);
$hond->changeHealth(-5);
// deel 3 v/d opdracht:
$simba = new Lion('Simba', 'male', 120, 'Congo lion');
$scar = new Lion('Scar', 'male', 120, 'Kenia lion');
$barcode = new Zebra('Barcode', 'male', 70, 'zwart met witte strepen');
$stripey = new Zebra('Stripey', 'female', 65, 'wit met zwarte strepen');
$_zebras = array($barcode, $stripey);
?>

<!DOCTYPE HTML>
<html>
<head>
	<title>Extends</title>
	<meta charset="UTF-8">
	<link href="http://web-backend.local/css/global.css"
	rel="stylesheet">
</head>
<body>
	<h2>Instanties van de Animal class</h2>
	<p>
开发者ID:K-VDG,项目名称:web-backend-oplossingen,代码行数:31,代码来源:application.php

示例11: __autoload

<?php

$class_name = "Animal";
function __autoload($class_name)
{
    include "classes/" . $class_name . '.php';
    include "classes/Lion.php";
    include "classes/Zebra.php";
}
$animal1 = new Animal("henk", "transgender", "50");
$animal2 = new Animal("oswalt", "male", "100");
$animal3 = new Animal("eric", "vrouw", "15");
$animal3->changeHealth(500);
$lion1 = new Lion("lil-pussy", "male", "50", "reggae-lion");
$lion2 = new Lion("jef", "male", "2350", "jazz-lion");
$zebra1 = new Zebra("lil-zebro", "male", "50", "reggae-zebra");
$zebra2 = new Zebra("jos", "male", "23", "jazz-zebra");
?>



<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
    	<title>Opdracht-classes-extends</title>

   <h3><?php 
echo $animal1->getProtectedName();
?>
 is een <?php 
开发者ID:rowanvanekeren,项目名称:web-backend-oplossingen,代码行数:31,代码来源:application.php

示例12: __autoload

<?php

function __autoload($className)
{
    require_once $className . '.php';
}
// ANIMAL CLASS
$panter = new Animal('Pink Panther', 'male', 100);
$hond = new Animal('Tipsy', 'male', 100);
$hond->changeHealth(-10);
$walvis = new Animal('Moby Dick', 'female', 80);
// LION CLASS (extends ANIMAL)
$simba = new Lion('Simba', 'male', 100, 'Congo lion');
$scar = new Lion('Scar', 'female', 100, 'Kenia lion');
// ZEBRA CLASS (extends ANIMAL)
$zeke = new Zebra('Zeke', 'male', 120, 'Quagga');
$zana = new Zebra('Zana', 'female', 100, 'Selous');
?>


<!DOCTYPE html>
<html>
<head>
	<title>Opdracht classes extends</title>
</head>
	<body>
	

		<h1>Opdracht classes extends</h1>
		
		
开发者ID:BenVaes,项目名称:web-backend-oplossingen,代码行数:29,代码来源:application.php

示例13: __autoload

<?php

function __autoload($class_name)
{
    include_once 'classes/' . $class_name . '.php';
}
$nieuwDier1 = new Animal('Kermit', 'male', 100);
#var_dump($nieuwDier1);
$nieuwDier2 = new Animal('Dikkie', 'male', 90);
#var_dump($nieuwDier2);
$nieuwDier3 = new Animal('Flipper', 'female', 80);
#var_dump($nieuwDier3);
$nieuwDier2->changeHealth(-7);
$move = $nieuwDier2->doSpecialMove();
$nieuwDier3->changeHealth(30);
$nieuweLeeuw1 = new Lion('Simba', 'male', 150, 'Congo lion');
$nieuweLeeuw2 = new Lion('Scar', 'male', 70, 'Kenya lion');
$nieuweZebra1 = new Zebra('Zeke', 'female', 55, 'Quagga');
$nieuweZebra2 = new Zebra('Zana', 'male', 95, 'Selous');
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Classes - Extends</title>
	<link rel="stylesheet" type="text/css" href="http://web-backend.local/css/global.css">
	<link rel="stylesheet" type="text/css" href="http://web-backend.local/css/directory.css">
	<link rel="stylesheet" type="text/css" href="http://web-backend.local/css/facade.css">
</head>
开发者ID:jobhenkens,项目名称:web-backend-oplossingen,代码行数:31,代码来源:application.php


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