0
$row_properties = array(
     "Header 1"=>array("width"=>20,"align"=>'C',"colors"=>array(100,220,255)),
     "Header 2"=>array("width"=>20,"align"=>'C',"colors"=>array(100,220,255)),
     "Header 3"=>array("width"=>20,"align"=>'C',"colors"=>array(100,220,255)),
);

I try to get the widths and algins colors as array like this

$widths = array(20,20,20);
$aligns  = array("C","C","C")
$colors  array(array(100,220,255),array(100,220,255),array(100,220,255));

3 Answers 3

3
$widths = $aligns = $colors = array();
foreach ($row_properties as $prop) {
  $widths[] = $prop['width'];
  $aligns[] = $prop['align'];
  $colors[] = $prop['color'];
}
Sign up to request clarification or add additional context in comments.

Comments

1
$widths = array();
$aligns = array();
$colors = array();

foreach($row_properties as $property) {
    $widths[] = $property['width'];
    $aligns[] = $property['align'];
    $colors[] = $property['colors'];
}

That's it :)

Comments

1
$widths = array();
$aligns  = array();
foreach($row_properties as $row){
   $widths[] = $row['width'];
   $aligns[] = $row['align'];
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.