<?php
class Foo
{
private $bar;
private $baz;
public function __construct($bar, $baz)
{
$this->bar = $bar;
$this->baz = $baz;
}
public function __debugInfo()
{
return ['bar' => $this->bar];
}
}
$foo = new Foo('abc', 'def');
print_r(debug_backtrace());
print_r($foo);
var_dump(debug_zval_dump($foo));
echo var_export($foo);
- Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Array
(
)
Foo Object
(
[bar] => abc
)
object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" interned
}
NULL
\Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
)
Foo Object
(
[bar] => abc
)
object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" interned
}
NULL
\Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 8.1.0 - 8.1.28
- Array
(
)
Foo Object
(
[bar] => abc
)
object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" interned
}
NULL
Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 7.0.0 - 7.0.20, 7.1.0, 7.1.7 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- Array
(
)
Foo Object
(
[bar] => abc
)
object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" refcount(1)
}
NULL
Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 7.1.5 - 7.1.6
- Array
(
)
Foo Object
(
[bar] => abc
)
object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" refcount(3)
}
NULL
Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 5.6.7 - 5.6.28
- Array
(
)
Foo Object
(
[bar] => abc
)
object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" refcount(2)
}
NULL
Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35
- Array
(
)
Foo Object
(
[bar:Foo:private] => abc
[baz:Foo:private] => def
)
object(Foo)#1 (2) refcount(2){
["bar":"Foo":private]=>
string(3) "abc" refcount(1)
["baz":"Foo":private]=>
string(3) "def" refcount(1)
}
NULL
Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
preferences:
172.51 ms | 402 KiB | 227 Q