Object to array

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->...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-08-2007
Bart the bear
 
Posts: n/a
Default Object to array

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?

Reply With Quote
  #2 (permalink)  
Old 08-08-2007
ELINTPimp
 
Posts: n/a
Default Re: Object to array

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

Reply With Quote
  #3 (permalink)  
Old 08-08-2007
Bart the bear
 
Posts: n/a
Default Re: Object to array

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!

Reply With Quote
  #4 (permalink)  
Old 08-08-2007
ELINTPimp
 
Posts: n/a
Default Re: Object to array

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.

Reply With Quote
  #5 (permalink)  
Old 08-08-2007
ELINTPimp
 
Posts: n/a
Default Re: Object to array

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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0