If an object is typecasted into an array and "extracted",only the public properties will be accessible.Methods are of course omitted.
<?php
class Test{
public $name = '';
protected $age = 10;
public $status = 'disabled';
private $isTrue = false;
public function __construct()
{
$this->name = 'Amolo';
$this->status = 'active';
}
public function getName()
{
return $this->name;
}
public function getAge()
{
return $this->age;
}
public function getStatus()
{
return $this->status;
}
}
$obj = (array) new Test();
var_dump($obj);
extract((array)new Test());
echo $name; echo $status; echo $age;echo $isTrue;