codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php class Person { private $name; public function __construct($name) { $this->name = $name; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } } function changeName(Person $person) { $person->setName("Michael"); } function changePerson(Person &$person) { $person = new Person("Jerry"); } $person = new Person("John"); changeName($person); echo $person->getName() . PHP_EOL; changePerson($person); echo $person->getName() . PHP_EOL;
Private
[
?
]
Run code
Submit