Jump to content

Name of Array Format


doubledee

Recommended Posts

What is the name for this Array Format...

 

$resultsArray[] = array('questionID' => $questionID,
				'question' => $question,
				'answer' => $new_answer,
				'DB_answer' => $old_answer,
				'message' => $message[$q]);

 

 

And does this have anything to do with Object-Oriented Programming?!

 

Thanks,

 

 

Debbie

 

Link to comment
https://forums.phpfreaks.com/topic/261748-name-of-array-format/
Share on other sites

It is a multidimensional array if that is what you are asking. That means that the array has more than one dimension.

Here's a one dimensional array:

 $array = array( 'key' => 'value' );

Here's a multidimensional array:

 $array = array( array( 'key' => 'value' ) );

 

Your array has more than one dimension because:

$resultsArray[]

Is an array due to the [] at the end of the string.

 

All types of arrays can be used with procedural or object oriented coding. So in a sense it has something to do with oop, but the array itself isn't object oriented.

 

If you google search "php array formats" you won't find anything relevant to what you're asking about.

If you google search "php object oriented arrays" you'll just find arrays used in object oriented code.

 

Hope I helped.

 

Edit: It turns out I know nothing and need to go back to school, I'm very close-minded and need to open up to new ideas and methods.

 

This guy has a class ( object ) which behaves like an array, so in a sense it's an object oriented array:

http://phpadvent.org/2011/better-object-oriented-arrays-by-ryan-parman

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.