This is a discussion on Object to array within the PHP Language forums, part of the PHP Programming Forums category; Is there a smarter way for this: $line_elems=array($new->machine, $new->channel, $new->time, $new->...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? |
|
|||
|
On Aug 8, 5:24 am, Bart the bear <barttheb...@gmail.com> 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/func...bject-vars.php |
|
|||
|
On Aug 8, 6:16 am, ELINTPimp <smsi...@gmail.com> wrote:
> > get_object_vars > > http://phpbuilder.com/manual/en/func...bject-vars.php Thanks! That is precisely what I was looking for! |
|
|||
|
On Aug 8, 7:43 am, Bart the bear <barttheb...@gmail.com> wrote:
> On Aug 8, 6:16 am, ELINTPimp <smsi...@gmail.com> wrote: > > > > > get_object_vars > > >http://phpbuilder.com/manual/en/func...bject-vars.php > > Thanks! That is precisely what I was looking for! Your welcome. |
|
|||
|
On Aug 8, 7:43 am, Bart the bear <barttheb...@gmail.com> wrote:
> On Aug 8, 6:16 am, ELINTPimp <smsi...@gmail.com> wrote: > > > > > get_object_vars > > >http://phpbuilder.com/manual/en/func...bject-vars.php > > Thanks! That is precisely what I was looking for! You're welcome. |