Are there any differences between get_object_vars($obj)
and (array) $obj
?
Both seem to return the public properties of the object.
The get_object_vars()
function is a clearer method of achieving the effect you want. Although casting it to an array is a solution as well, this behavior might change in later versions of PHP.
I don't know if there is an actual difference between the two methods but the arguments above would lead me to use the function.