Object to array

Object to array

am 08.08.2007 11:24:02 von Bart the bear

Is there a smarter way for this:
$line_elems=array($new->machine,
$new->channel,
$new->time,
$new->bday,
$new->eday,
$new->name);
$line = join(':',$line_elems);
$line="$line\n";

Is there a function (cast?) to convert object to an array without
listing all the
members?

Re: Object to array

am 08.08.2007 12:16:59 von ELINTPimp

On Aug 8, 5:24 am, Bart the bear wrote:
> Is there a smarter way for this:
> $line_elems=array($new->machine,
> $new->channel,
> $new->time,
> $new->bday,
> $new->eday,
> $new->name);
> $line = join(':',$line_elems);
> $line="$line\n";
>
> Is there a function (cast?) to convert object to an array without
> listing all the
> members?


get_object_vars

http://phpbuilder.com/manual/en/function.get-object-vars.php

Re: Object to array

am 08.08.2007 13:43:30 von Bart the bear

On Aug 8, 6:16 am, ELINTPimp wrote:
>
> get_object_vars
>
> http://phpbuilder.com/manual/en/function.get-object-vars.php


Thanks! That is precisely what I was looking for!

Re: Object to array

am 08.08.2007 14:07:05 von ELINTPimp

On Aug 8, 7:43 am, Bart the bear wrote:
> On Aug 8, 6:16 am, ELINTPimp wrote:
>
>
>
> > get_object_vars
>
> >http://phpbuilder.com/manual/en/function.get-object-vars.ph p
>
> Thanks! That is precisely what I was looking for!

Your welcome.

Re: Object to array

am 08.08.2007 14:08:04 von ELINTPimp

On Aug 8, 7:43 am, Bart the bear wrote:
> On Aug 8, 6:16 am, ELINTPimp wrote:
>
>
>
> > get_object_vars
>
> >http://phpbuilder.com/manual/en/function.get-object-vars.ph p
>
> Thanks! That is precisely what I was looking for!

You're welcome.