Re: Programming general question
| From: | Edmund Hertle | Date: | Wed, 28 Jan 2009 00:07:49 +0000 |
| Subject: | Re: Programming general question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287251@lists.php.net to get a copy of this message | ||
2009/1/28 Terion Miller <webdev.terion@gmail.com>
> 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
Hey,
Arrays: A structure to store data
Example:
$example = array("value1", "value2", "value3);
echo $example[0]; // echos "value1"
echo $example[2]; // echos "value3"
Object: Something totally diffrent. A object is an instance of a class.
Contains variables and methods.
I don't know how you thought of using arrays or objects for the same
problem? Can you give an example?
Try this for arrays: http://de2.php.net/manual/en/language.types.array.php
You should look for "object-oriented programming" to understand what an
object is
Then you will get help here:
http://de2.php.net/manual/en/language.oop5.basic.php
-eddy