Re: Re: Programming general question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 28, 2009 at 3:54 AM, Ondrej Kulaty <kopyto911@xxxxxxxxx> wrote:

> Depends on what for you want to use that. Array is simple data structure,
> it
> holds data, like variable, but objects has methods and properties, it acts
> as someting which can do some sort of task and you access it via it's
> interface (you call it's methods). You can use array for example to hold
> result from database and than iterate it with for or foreach cycle. On the
> other hand, object can be used for exaplme to send mail, you put into it
> text body, mail adresses and so on and then call it's method send() which
> causes mail to be send. The process of transforming data, generating
> headers
> etc is completely done by the object and it's internal methods, you access
> it only via it's well defined interface (it's methods you can call).
> Objects
> are mainly used in OOP programming, where they cooperate together. Good way
> to learn OOP is to learn something about design patterns...
> --
>
>
> "Terion Miller" <webdev.terion@xxxxxxxxx> píse v diskusním príspevku
> news:37405f850901271518r21f5f73j44841e864de5c598@xxxxxxxxxxxxxxxxx
> >I googled this and didn't find an answer ....
> > my question is how do you know when to use an object or array
> >
> > would an object just be 1 instance, and array is several things together
> > ( I
> > know infantile coder language I use..but I'm a baby still in this)
> >
> > Can someone explain objects and arrays in plain speak for me?
> > Thanks
> > Happy Coding
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Thanks for all the information, I was asking because I inherited thousands
of lines of code that had used mysql_fetch_object(), yet I kept getting so
many errors so I starting playing with changing them to mysql_fetch_assoc()
and things seem to work better, so I was wonder why sometimes data from a db
field can be used as an object or array, the arrays, objects, classes still
confuses me..oh add functions to that, is there a hiearchy?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux