Sunday, 12 May 2019

arrays - iterating over things in php

I have an array called $options.
I want iterate through it's contents, so I do:



 foreach($options as $option){   
print_r( $option);
}



The resulting output gives me an object/array heffalump that starts like this...



Mage_Bundle_Model_Option Object
(
[_defaultSelection:protected] =>
[_eventPrefix:protected] => core_abstract
[_eventObject:protected] => object
[_resourceName:protected] => bundle/option
[_isObjectNew:protected] =>

[_data:protected] => Array
(
[option_id] => 20
[parent_id] => 291


I want to reference values in _data, but I am stumped as to correct syntax to do this...

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...