3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-Type: text/html; charset=utf-8'); $arr = array( array( 'text' => 'Текст красного цвета', 'align' => 'center', 'valign' => 'center', 'bgcolor' => '#0000FF', 'colspan' => 2, 'rowspan' => 2, 'width' =>200, 'class' =>'red' ) , array( 'text' => 'Текст зеленого цвета' , 'cells' => '8,9' , 'align' => 'right' , 'valign' => 'bottom' , 'bgcolor' => '#FFFFFF', 'colspan' => 2, 'class' =>'green' )); $array0 = $arr[0]; $array1 = $arr[1]; $firstArray0 = array_shift($array0); $firstArray1 = array_shift($array1); $td1 .= "<td "; foreach ($array0 as $k0 => $v0) { $td1 .= $k0."=".$v0." "; } $td1 .= ">"; $td1 .= $firstArray0; $td1 .= "</td>"; $td2 .= "<td "; foreach ($array1 as $k1 => $v1) { $td2 .= $k1."=".$v1." "; } $td2 .= ">"; $td2 .= $firstArray1; $td2 .= "</td>"; $td = "<td width='100' height='100'></td>"; $table .= "<table>"; for ($i=0, $td1; $i<3; $i++) { $table .= "<tr>"; if ($i == 0) { $table .= $td1; $table .= $td; } elseif ($i == 1) { $table .= $td; } elseif ($i == 2) { $table .= $td; $table .= $td2; } $table .= "</tr>"; } $table .= "</table>"; echo "<!DOCTYPE html>"; echo "<style>td{border: 1px solid black;} .red{color:red} .green{color:green}</style>"; echo $table;
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: td1 in /in/8hWmu on line 27 Notice: Undefined variable: td2 in /in/8hWmu on line 35 Notice: Undefined variable: table in /in/8hWmu on line 45 <!DOCTYPE html><style>td{border: 1px solid black;} .red{color:red} .green{color:green}</style><table><tr><td align=center valign=center bgcolor=#0000FF colspan=2 rowspan=2 width=200 class=red >Текст красного цвета</td><td width='100' height='100'></td></tr><tr><td width='100' height='100'></td></tr><tr><td width='100' height='100'></td><td cells=8,9 align=right valign=bottom bgcolor=#FFFFFF colspan=2 class=green >Текст зеленого цвета</td></tr></table>
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: td1 in /in/8hWmu on line 27 Notice: Undefined variable: td2 in /in/8hWmu on line 35 Notice: Undefined variable: table in /in/8hWmu on line 45 <!DOCTYPE html><style>td{border: 1px solid black;} .red{color:red} .green{color:green}</style><table><tr><td align=center valign=center bgcolor=#0000FF colspan=2 rowspan=2 width=200 class=red >Текст красного цвета</td><td width='100' height='100'></td></tr><tr><td width='100' height='100'></td></tr><tr><td width='100' height='100'></td><td cells=8,9 align=right valign=bottom bgcolor=#FFFFFF colspan=2 class=green >Текст зеленого цвета</td></tr></table>