3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $d = array( 0 => array( 0 => '', 1 => 'Man', 2 => '<p class=" td26">', 3 => '<p class=" td26">', 4 => '<p class=" td26">', 5 => 'Mining'), 1 => array ( 0 => '', 1 => 'Abc', 2 => '<p class="tr1 td26"><p class=" td26">', 3 => 'Ahsan', 4 => '<p class="tr1 td26"><p class=" td26">', 5 => 'mm', 6 => '<p class="tr1 td26"><p class=" td26">', 7 => 'oo', 8 => '<p class="tr1 td26"><p class=" td26">', 9 => 'kk', 10 => '<p class="tr1 td26"><p class=" td26">'), 2 => array ( 0 => 'Fical', 1 => '2005-06', 2 => '2006-07', 3 => '2007-08', 4 => '2008-09', 5 => '2009-10', 6 => '2010-11', 7 => '2011-12', 8 => '2012-13', 9 => 'Change', 10 => 'Change2' ) ); $d = $k; foreach ($d as $k => $v) { if (($v == '') && ($k !== 0)) { $d[$k] .= "\n<p class=\" td26\">"; $d[$k - 1] .= "<p class=\"tr3 td26\">"; // K-1 for previous index } } foreach ($g as $k => $v) { if (($v == '') && ($k !== 0)) { $g[$k] .= "<p class=\" td26\">"; //$g[$k-1].="<p class=\" td26\">" ; } }
Output for 5.1.0 - 7.1.0
Notice: Undefined variable: k in /in/81ZE0 on line 40 Warning: Invalid argument supplied for foreach() in /in/81ZE0 on line 43 Notice: Undefined variable: g in /in/81ZE0 on line 50 Warning: Invalid argument supplied for foreach() in /in/81ZE0 on line 50
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: k in /in/81ZE0 on line 40 Warning: Invalid argument supplied for foreach() in /in/81ZE0 on line 43 Warning: Invalid argument supplied for foreach() in /in/81ZE0 on line 50
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.3
Notice: Undefined variable: k in /in/81ZE0 on line 40 Warning: Invalid argument supplied for foreach() in /in/81ZE0 on line 43 Warning: Invalid argument supplied for foreach() in /in/81ZE0 on line 50
Output for 4.3.11
Notice: Undefined variable: k in /in/81ZE0 on line 40