php ->

Fark_Maniac

2[H]4U
Joined
Feb 21, 2002
Messages
2,438
I've seen this in plenty of people's example code, but can only guestimate it relatest to arrays. I've always thought the best way was $array['Field1'] ... $array['otherfield']

can someone lay out the differences...benifits..etc?

I appreciate it
 
Fark_Maniac said:
I've seen this in plenty of people's example code, but can only guestimate it relatest to arrays. I've always thought the best way was $array['Field1'] ... $array['otherfield']

can someone lay out the differences...benifits..etc?

I appreciate it

You can do more then 'guestimate', you can read the manual section on arrays . PHP has a very nice online manual with answers to these types of questions... good search functionality too.
 
Fark_Maniac said:
I've seen this in plenty of people's example code, but can only guestimate it relatest to arrays. I've always thought the best way was $array['Field1'] ... $array['otherfield']

can someone lay out the differences...benifits..etc?

I appreciate it

it's used for classes and objects. for example, to go through a recordset using objects instead of arrays.
Code:
Using arrays
while ($record = mysql_fetch_array($rs)
{
 echo($record['field1'] . ", " . $record['field2'])
}

using objects
while ($record = mysql_fetch_object($rs)
{
  echo ($record->field1 . ", " . $record->field2);
}
 
maw...that made the most sense...more so than the manual and all the google searches...not sure why. I use a lot of mysql queries and this is the sort of thing that I'd use these things.
 
Back
Top