Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Getting object values into an array?

Quote Reply
Getting object values into an array?
Hi!

Can anyone tell me how to turn all values of a class object into an array that can be used for an insert?

So for example my object has set values for..

$this->firstname = 'firstname';
$this->middlename = 'middlename';
$this->lastname = 'lastname';

etc etc etc...

What I want to do is pass that information into an insert statement something like this...

$DB->insert('table',$object);

while still inside the class. Everything I've tried throws back errors.

Can anyone help?

regan.
Quote Reply
Re: [ryel01] Getting object values into an array? In reply to
If I understand you correctly, I think get_object_vars() is what you are looking for.