3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST['sections'] = [ [ 'sectionwidth' => 525, 'sectionheight' => 500, 'bg' => 'eaeaea', 'sectioncolor' => 'c0c0c0', 'input' => [ [ 'inputtext' => 'test', 'inputwidth' => 505 ], [ 'inputtext' => 'test2', 'inputwidth' => 505 ] ] ], [ 'sectionwidth' => 525, 'sectionheight' => 500, 'bg' => '222222', 'sectioncolor' => 'ffffff', 'input' => [ [ 'inputtext' => 'test3', 'inputwidth' => 505 ], [ 'inputtext' => 'test4', 'inputwidth' => 505 ] ] ], ]; foreach ($_POST['sections'] as $section) { echo '<div style="width: '.$section['sectionwidth'].'px; height: '.$section['sectionheight'].'px; background: #'.$section['bg'].'; color: '.$section['sectioncolor'].'">'; foreach ($section['input'] as $input) { echo '<p style="width: '.$input['inputwidth'].'px;">'.$input['inputtext'].'</p>'; } echo '</div>'; }
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
<div style="width: 525px; height: 500px; background: #eaeaea; color: c0c0c0"><p style="width: 505px;">test</p><p style="width: 505px;">test2</p></div><div style="width: 525px; height: 500px; background: #222222; color: ffffff"><p style="width: 505px;">test3</p><p style="width: 505px;">test4</p></div>

preferences:
231.44 ms | 404 KiB | 293 Q