Object or Array??

  • Follow


Hello there...

I have a little issue here....

Which one is better(I think object) but would like to hear from someone more
experienced....

class Persons
{
 var $name;
 var $comments;
 var $thoughts;
 var $email;

some functions.....
}

object in array:

while($line = $result->FetchRow())           //using ADODB
{
 $person[$line['id']] = &new Persons;
 $person[$line['id']]->name = $line['name'];
 $person[$line['id']]->thoughts = $line['thoughts'];
 $person[$line['id']]->email = $line['email'];
 $person[$line['id']]->comments = $line['comments'];
}

or plain array:

while($line = $result->FetchRow())

$person[$line['id']]=Array("name"=>$line['name'],"thoughts"=>$line['thoughts
'],"email"=>$line['email'],"comments"=>$line['comments']);

thanx and respect....

p.




0
Reply point5404 (24) 9/7/2003 9:53:24 AM

"point" <point@caanNOSPAMproduction.com> wrote 
   in message news:<bjev3q02vgv@enews2.newsguy.com>...
> 
> Which one is better (I think object) but would like to hear 
> from someone more experienced....

Define "better".  Better for what?  Reusability?  Go with objects. 
Performance?  Stick with arrays and stop using abstraction layers. 

Cheers, 
NC
0
Reply nc (1051) 9/7/2003 7:27:00 PM


Thanx for your oppinions....

I'm sticking with objects just wanted to hear your oppinions....

In my oppinion objects are more close(although more abstract) to human way
of thinking than the procedural programing.....

respect....



"point" <point@caanNOSPAMproduction.com> wrote in message
news:bjev3q02vgv@enews2.newsguy.com...
> Hello there...
>
> I have a little issue here....
>
> Which one is better(I think object) but would like to hear from someone
more
> experienced....
>
> class Persons
> {
>  var $name;
>  var $comments;
>  var $thoughts;
>  var $email;
>
> some functions.....
> }
>
> object in array:
>
> while($line = $result->FetchRow())           //using ADODB
> {
>  $person[$line['id']] = &new Persons;
>  $person[$line['id']]->name = $line['name'];
>  $person[$line['id']]->thoughts = $line['thoughts'];
>  $person[$line['id']]->email = $line['email'];
>  $person[$line['id']]->comments = $line['comments'];
> }
>
> or plain array:
>
> while($line = $result->FetchRow())
>
>
$person[$line['id']]=Array("name"=>$line['name'],"thoughts"=>$line['thoughts
> '],"email"=>$line['email'],"comments"=>$line['comments']);
>
> thanx and respect....
>
> p.
>
>
>
>


0
Reply point5404 (24) 9/8/2003 7:27:02 PM

2 Replies
31 Views

(page loaded in 0.053 seconds)

Similiar Articles:













7/15/2012 1:04:49 PM


Reply: