Page 1 of 1

$object -> $array

Posted: Fri Jun 17, 2005 11:05 am
by bokehman
How do I turn an object into an array?
or
How do I make an array that contains the contents of an object?

Posted: Fri Jun 17, 2005 12:48 pm
by Skara
you need to read up on what an object is.
http://php.net/oop

Posted: Fri Jun 17, 2005 1:09 pm
by andre_c
typecast it
http://us3.php.net/language.types.type-juggling

Code: Select all

<?php
$object = new MyObject;

$object_array = (array) $object;
?>