on-internet
← Community

PHP assoc array to class instance

Stack Overflow ·

I saw that the conversion from a class instance (object) to associative array is a simple cast : $array = (array) $yourObject; So if i have class A and an associative array contaning the neccesary fields to fill a class A object would it be enough to do the opposite? e.g $aInstance=(A)$assocArray; If not whats the easiest way to do so?

Comments

Sign in or sign up to comment and upvote.

No comments yet.