plugin development – Stuck at MultiDimensional Array

Question

I am using to get values from array this code

UPDATED CODE

$specifications_group = $product->post->post_parent > 0 ? $product->post->post_parent : $product->post->ID;                 
$fields_spec_r = get_fields( $specifications_group);
$spec_data="";
    $rpt_spc1 = $fields_spec1[features_repeater];
                foreach ($rpt_spc1[0] as $keys => $items) {
                    foreach ($items as $spec2) {
                 $spec_data1 .= trim($spec2[0]['c']) . ' ' . trim($spec2[1]['c']);
                 $spec_data1 .= "\r\n"; } }

$fields_spec_r function returns multidimensional array below

[specs_products] 
[feature_products]   
[features_repeater]  
  [features_repeater_features]

So i only need features_repeater_features array values like

Weight : 10 lbs

But i am getting empty strings. Can anybody help me? Thanks in advance

$rpt_spc1 = $fields_spec1[features_repeater]; returns this array :

>    [0]=>   array(2) {
>     ["features_repeater_features"]=>
>     array(3) {
>       ["header"]=>
>       bool(false)
>       ["caption"]=>
>       bool(false)
>       ["body"]=>
>       array(8) {
>         [0]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(11) "Class A SRL"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
>             string(0) ""
>           }
>         }
>         [1]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(10) "Materials:"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
> 
>           }
>         }
>         [2]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(7) "Weight:"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
>             string(17) "3.5 lbs. (1.6 kg)"
>           }
>         }
>         [3]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(7) "Length:"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
>             string(10) "7' (2.1 m)"
>           }
>         }
>         [4]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(21) "ANSI Weight Capacity:"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
>             string(24) "130-310 lbs. (59-141 kg)"
>           }
>         }
>         [5]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(22) "OSHA Weight Capacity: "
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
>             string(23) "Up to 420 lbs. (191 kg)"
>           }
>         }
>         [6]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(15) "ANSI Standards:"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
> 
>           }
>         }
>         [7]=>
>         array(2) {
>           [0]=>
>           array(1) {
>             ["c"]=>
>             string(15) "OSHA Standards:"
>           }
>           [1]=>
>           array(1) {
>             ["c"]=>
>             string(8) "1926.502"
>           }
>         }
>       }
>     }

0
bekoyzc 3 months 2022-05-25T18:52:02-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse