<?php
$arr = [
"title" =>
[
0 => "title1",
1 => "title2",
2 => "title3",
],
"icon-class" =>
[
0 => "class1",
1 => "class2",
2 => "class3",
],
"text" =>
[
0 => "text1",
1 => "text2",
2 => "text3",
],
"link-text" =>
[
0 => "link-text1",
1 => "link-text2",
2 => "link-text3",
],
"link" =>
[
0 => "link-text1",
1 => "link-text2",
2 => "link-text3",
],
];
// fetching keys
$keys = array_keys($arr);
// transposing array with removing string keys to integer
$temp = array_map(null, ...array_values($arr));
// combining fetched keys and values by transpose
$temp = array_map(function ($item) use ($keys) {return array_combine($keys, $item);}, $temp);
?>
<ul>
<?php foreach($temp as $v): ?>
<li>
<h3 class="<?php echo $v['icon-class'] ?>"><?php echo $v['title'];?></h3>
<p><?php echo $v['text'];?></p>
<a href="<?php echo $v['link']; ?>"><?php echo $v['link-text']?></a>
</li>
<?php endforeach; ?>
</ul>
preferences:
25.11 ms | 407 KiB | 5 Q