<?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');
var_dump(debug_zval_dump($foo));
echo var_export($foo);
- Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- 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
- 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.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- object(Foo)#1 (1) refcount(2){
["bar"]=>
string(3) "abc" refcount(1)
}
NULL
Foo::__set_state(array(
'bar' => 'abc',
'baz' => 'def',
))
- Output for 5.6.0 - 5.6.40
- 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.0 - 5.4.45, 5.5.0 - 5.5.38
- 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:
253.77 ms | 402 KiB | 374 Q