SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | class Object implements Serializable {
| |
| 3 | private $data; | |
| 4 | ||
| 5 | function __construct($data) {
| |
| 6 | $this->data = $data; | |
| 7 | } | |
| 8 | ||
| 9 | public function serialize() {
| |
| 10 | return serialize($this->data); | |
| 11 | } | |
| 12 | ||
| 13 | public function unserialize($s) {
| |
| 14 | $this->data = unserialize($s); | |
| 15 | } | |
| 16 | ||
| 17 | public function printObj() {
| |
| 18 | return serialize($this); | |
| 19 | } | |
| 20 | } | |
| 21 | ||
| 22 | ?> | |
| 23 | <?php | |
| 24 | class Login {
| |
| 25 | private $text = ''; | |
| 26 | ||
| 27 | public function __construct($text) {
| |
| 28 | $this->text = $text; | |
| 29 | } | |
| 30 | ||
| 31 | public function __toString() {
| |
| 32 | return $this->text; | |
| 33 | } | |
| 34 | } | |
| 35 | ?> | |
| 36 | ||
| 37 | <?php | |
| 38 | ||
| 39 | class Password {
| |
| 40 | private $text = ''; | |
| 41 | ||
| 42 | public function __construct($text) {
| |
| 43 | $this->text = $text; | |
| 44 | } | |
| 45 | ||
| 46 | public function __toString() {
| |
| 47 | return $this->text; | |
| 48 | } | |
| 49 | } | |
| 50 | class Flag {
| |
| 51 | public static $flag = "FLAG"; | |
| 52 | ||
| 53 | public function getFlags() {
| |
| 54 | return array(1); | |
| 55 | } | |
| 56 | } | |
| 57 | ||
| 58 | ||
| 59 | class User {
| |
| 60 | private $login; | |
| 61 | private $password; | |
| 62 | ||
| 63 | public function __construct($login, $password) {
| |
| 64 | $this->login = $login; | |
| 65 | $this->password = $password; | |
| 66 | } | |
| 67 | ||
| 68 | public function __toString() {
| |
| 69 | return $this->login.':'.$this->password; | |
| 70 | } | |
| 71 | ||
| 72 | public function __sleep() {
| |
| 73 | return $this->login->{$this->password}();
| |
| 74 | } | |
| 75 | ||
| 76 | } | |
| 77 | ?> | |
| 78 | ||
| 79 | <?php | |
| 80 | ||
| 81 | ?> | |
| 82 | ||
| 83 | <?php | |
| 84 | class Textbox {
| |
| 85 | private $obj; | |
| 86 | ||
| 87 | public function __construct($obj) {
| |
| 88 | $this->obj = $obj; | |
| 89 | } | |
| 90 | ||
| 91 | function __toString() {
| |
| 92 | return $this->obj->printObj(); | |
| 93 | } | |
| 94 | } | |
| 95 | ?> |