3v4l.org

run code in 300+ PHP versions simultaneously
<?php //да се намерят реда и колоната с най-голяма стойност $arr = [ [1, 4, 7,10], [2, 5, 8,11], [3, 6, 9,12], [13,14,15,16] ]; $maxRow = 0; $maxCol = 0; $fromMaxRow = 0; $fromMaxCol = 0; $cols = []; foreach($arr as $keyRow => $row) { $sum = array_sum($row); if($maxRow < $sum) { $maxRow = $sum; $fromMaxRow = $keyRow + 1; } foreach($row as $keyCell => $cell) { $cols[$key][] = $cell; } } foreach ($cols as $key => $col) { $sum = array_sum($col); if($maxCol < $sum) { $maxCol = $sum; $fromMaxCow = $key + 1; } } echo "Max row is $fromMaxRow with $maxRow sum \n"; echo "Max col is $fromMaxCol with $maxCol sum \n";
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Warning: Undefined variable $key in /in/Ke9bN on line 29 Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /in/Ke9bN:38 Stack trace: #0 {main} thrown in /in/Ke9bN on line 38
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.19 ms | 402 KiB | 8 Q