3v4l.org

run code in 300+ PHP versions simultaneously
<?php fgets(STDIN); $numbers = explode(' ', rtrim(fgets(STDIN))); $valuePerWife = array_sum($numbers) / 2; // Taken from here: http://stackoverflow.com/a/13194803/603003 // Credits to dAngelov: http://stackoverflow.com/users/955185/dangelov function pc_permute($items, $perms = array( )) { if (empty($items)) { $return = array($perms); } else { $return = array(); for ($i = count($items) - 1; $i >= 0; --$i) { $newitems = $items; $newperms = $perms; list($foo) = array_splice($newitems, $i, 1); array_unshift($newperms, $foo); $return = array_merge($return, pc_permute($newitems, $newperms)); } } return $return; } foreach (pc_permute($numbers) as $permutation) { $sum = 0; $rest = []; for ($i=0; $i<count($permutation); $i++) { $sum += $permutation[$i]; if ($sum == $valuePerWife) { $rest = array_slice($permutation, $i + 1); break; } } if (array_sum($rest) == $valuePerWife) { echo implode(' ', array_slice($permutation, 0, $i + 1)), "\n"; echo implode(' ', array_slice($permutation, $i + 1)), "\n"; echo 'diff=0'; exit; } } exit('DIDNT FOUND ANY COMBINATION!');
Output for git.master, git.master_jit
Fatal error: Uncaught TypeError: Unsupported operand types: int + string in /in/tMTs7:30 Stack trace: #0 {main} thrown in /in/tMTs7 on line 30
Process exited with code 255.
Output for rfc.property-hooks
Warning: array_sum(): Addition is not supported on type string in /in/tMTs7 on line 4 Fatal error: Uncaught TypeError: Unsupported operand types: int + string in /in/tMTs7:30 Stack trace: #0 {main} thrown in /in/tMTs7 on line 30
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:
41.2 ms | 401 KiB | 8 Q