<?php function everything_is_elephant($foo, &$bar, $baz) { $foo = $bar = $baz = "elephant"; } $a = $b = $c = "giraffe"; everything_is_elephant($a, $b, $c); echo "{$a} {$b} {$c} \n"; class Giraffe { public function changeMe(&$zee) { $zee = "giraffe"; } } $o = "otter"; $g = new Giraffe(); $g->changeMe($o); echo $o . "\n"; $anon = function (&$x) { $x++; }; $x = 20; $anon($x); echo $x . "\n";
{ echo 'It is an elephant<br>Name: ' . $this->name . '<br>Age: ' . $this->age . '<br>Sex: ' . $this->sex . '<br>Destination: ' . $this->destination . '<br><br>'; } } class Giraffe extends Mamal { public $necklength; public function __construct($name, $age, $sex, $necklength) { parent::__construct($name, $age, $sex); $this->necklength = $necklength; } public function info() { echo 'It is an giraffe<br>Name: ' . $this->name . '<br>Age: ' . $this->age . '<br>Sex: ' . $this->sex . '<br>Necklength: ' . $this->necklength . '<br><br>'; } } $mike = new Animal('Mike', 29); $mike->info(); $amphimike = new Amphibian('Amphimike', 29, 'true'); $amphimike->info(); $frogmike = new Frog('Frogmike', 29, 'false', 'green'); $frogmike->info(); $tritonmike = new Triton('Mike', 31, 'true', '20 mm'); $tritonmike->info(); $mamalmike = new Mamal('Mamalmike', '18', 'male'); $mamalmike->info(); $elephantmike = new Elephant('Mike', 12, 'female', 'India'); $elephantmike->info(); $giraffemike = new Giraffe('Nina', 4, 'female', '2m'); $giraffemike->info();