I am a newbie and need help calling php array. I am using var_dump and showing this

I'm first looking for help from any expert here for calling a PHP array. I am trying to use var_dump

but still I cannot name my data. I am really a beginner and need a lot of help. Thanks before reading my question below ...

<?php var_dump($this->product->customfieldsSorted); ?>

      

I use this and get this list of arrays ...

array(1) {
["normal"]=>
array(1) {
  [0]=>
  object(stdClass)#222 (36) {
    ["virtuemart_custom_id"]=>
    string(2) "21"
    ["custom_parent_id"]=>
    string(1) "0"
    ["virtuemart_vendor_id"]=>
    string(1) "1"
    ["custom_jplugin_id"]=>
    string(1) "0"
    ["custom_element"]=>
    string(0) ""
    ["admin_only"]=>
    string(1) "0"
    ["custom_title"]=>
    string(5) "Slide"
    ["show_title"]=>
    string(1) "0"
    ["custom_tip"]=>
    string(0) ""
    ["custom_value"]=>
    string(0) ""
    ["custom_desc"]=>
    string(0) ""
    ["field_type"]=>
    string(1) "M"
    ["is_list"]=>
    string(1) "0"
    ["is_hidden"]=>
    string(1) "1"
    ["is_cart_attribute"]=>
    string(1) "0"
    ["is_input"]=>
    string(1) "0"
    ["layout_pos"]=>
    string(0) ""
    ["custom_params"]=>
    string(26) "width="1024"|height="400"|"
    ["shared"]=>
    string(1) "0"
    ["published"]=>
    string(1) "1"
    ["ordering"]=>
    string(1) "0"
    ["virtuemart_customfield_id"]=>
    string(3) "110"
    ["virtuemart_product_id"]=>
    string(2) "95"
    ["customfield_value"]=>
    string(2) "15"
    ["customfield_price"]=>
    NULL
    ["customfield_params"]=>
    string(25) "width="200"|height="200"|"
    ["fpublished"]=>
    string(1) "0"
    ["override"]=>
    string(1) "0"
    ["disabler"]=>
    string(1) "0"
    ["_varsToPushParamCustom"]=>
    array(2) {
      ["width"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
      ["height"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
    }
    ["_varsToPushParamCustomField"]=>
    array(2) {
      ["width"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
      ["height"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
    }
    ["_varsToPushParam"]=>
    array(2) {
      ["width"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
      ["height"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
    }
    ["width"]=>
    string(3) "200"
    ["height"]=>
    string(3) "200"
    ["_xParams"]=>
    string(18) "customfield_params"
    ["display"]=>
    string(101) "<img src="/angga/images/stories/virtuemart/product/resized/marinecap_200x200.jpg" alt="marinecap"  />"
  }
}

      

No, I want to receive:

["display"]=>
string(101) "<img src="/angga/images/stories/virtuemart/product/resized/marinecap_200x200.jpg" alt="marinecap"  />"

      

using this:

<?php echo $this->product->customfieldsSorted->display;?>

      

and got nothing. Can anyone please help? I have no idea. Not at all. Thanks before :)

+3


source to share


1 answer


$this->product->customfieldsSorted

- an array with the key "normal"

, you can get the appropriate value: $this->product->customfieldsSorted['normal']

.

$this->product->customfieldsSorted['normal']

- an array with the key 0

, to get its value: $this->product->customfieldsSorted['normal'][0]

.



$this->product->customfieldsSorted['normal'][0]

is an object stdClass

, you can get the value of a property display

with $this->product->customfieldsSorted['normal'][0]->display

.

+1


source







All Articles