xref: /PHP-7.4/Zend/tests/magic_methods_001.phpt (revision 782352c5)
1--TEST--
2Testing several magic methods
3--FILE--
4<?php
5
6class foo {
7	function __unset($a) {
8		print "unset\n";
9		var_dump($a);
10	}
11
12	public function __call($a, $b) {
13		print "call\n";
14		var_dump($a);
15	}
16	function __clone() {
17		print "clone\n";
18	}
19	static public function __callstatic($a, $b) {
20		print "callstatic\n";
21	}
22
23	public function __tostring() {
24		return 'foo';
25	}
26}
27
28
29$a = new foo;
30
31$a->sdfdsa();
32
33$a::test();
34
35clone $a;
36
37var_dump((string)$a);
38
39unset($a->a);
40
41?>
42--EXPECT--
43call
44string(6) "sdfdsa"
45callstatic
46clone
47string(3) "foo"
48unset
49string(1) "a"
50