3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tryDistributeLinksEvenly($howManyMessages, $links){ echo "testing $howManyMessages\n"; $messages = array_chunk($links, $howManyMessages, true); $count = 0; foreach($messages as $message){ $count += array_reduce(array_keys($message), function($a, $b){ return mb_strlen($a) + mb_strlen($b) + 2; }); var_dump($message); echo $count . "\n"; } echo "-----\n"; } function distributeLinksEvenly($links){ $howManyMessages = 0; do{ $howManyMessages++; $chunks = tryDistributeLinksEvenly($howManyMessages, $links); if($howManyMessages > 10) exit(); }while($chunks === null); return $chunks; } $v = [ 'aaaa', 'bbbb', 'ccccccc', 'dddddddddd', 'eeeeeeee', 'ffffffffffff', 'gggg', 'hhhhhh', 'iiiiiiiiiii', 'lllllll', 'mmmmmmmmmmm', 'nnnnnnn', 'ooo', ]; $v = array_combine($v, $v); distributeLinksEvenly($v);
Output for git.master, git.master_jit, rfc.property-hooks
testing 1 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["aaaa"]=> string(4) "aaaa" } 6 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["bbbb"]=> string(4) "bbbb" } 12 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ccccccc"]=> string(7) "ccccccc" } 21 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["dddddddddd"]=> string(10) "dddddddddd" } 33 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["eeeeeeee"]=> string(8) "eeeeeeee" } 43 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ffffffffffff"]=> string(12) "ffffffffffff" } 57 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["gggg"]=> string(4) "gggg" } 63 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["hhhhhh"]=> string(6) "hhhhhh" } 71 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" } 84 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["lllllll"]=> string(7) "lllllll" } 93 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" } 106 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["nnnnnnn"]=> string(7) "nnnnnnn" } 115 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ooo"]=> string(3) "ooo" } 120 ----- testing 2 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" } 7 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" } 20 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" } 36 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" } 45 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" } 56 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" } 67 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ooo"]=> string(3) "ooo" } 72 ----- testing 3 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(3) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" } 10 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(3) { ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" } 26 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(3) { ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" } 40 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(3) { ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" } 51 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ooo"]=> string(3) "ooo" } 56 ----- testing 4 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(4) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" } 14 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(4) { ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" } 23 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(4) { ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" } 34 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ooo"]=> string(3) "ooo" } 39 ----- testing 5 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(5) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" } 12 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(5) { ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" } 23 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(3) { ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" ["ooo"]=> string(3) "ooo" } 30 ----- testing 6 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(6) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" } 16 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(6) { ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" } 27 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(1) { ["ooo"]=> string(3) "ooo" } 32 ----- testing 7 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(7) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" } 8 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(6) { ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" ["ooo"]=> string(3) "ooo" } 15 ----- testing 8 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(8) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" } 9 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(5) { ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" ["ooo"]=> string(3) "ooo" } 16 ----- testing 9 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(9) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" } 14 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(4) { ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" ["ooo"]=> string(3) "ooo" } 21 ----- testing 10 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(10) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" } 11 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(3) { ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" ["nnnnnnn"]=> string(7) "nnnnnnn" ["ooo"]=> string(3) "ooo" } 18 ----- testing 11 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(11) { ["aaaa"]=> string(4) "aaaa" ["bbbb"]=> string(4) "bbbb" ["ccccccc"]=> string(7) "ccccccc" ["dddddddddd"]=> string(10) "dddddddddd" ["eeeeeeee"]=> string(8) "eeeeeeee" ["ffffffffffff"]=> string(12) "ffffffffffff" ["gggg"]=> string(4) "gggg" ["hhhhhh"]=> string(6) "hhhhhh" ["iiiiiiiiiii"]=> string(11) "iiiiiiiiiii" ["lllllll"]=> string(7) "lllllll" ["mmmmmmmmmmm"]=> string(11) "mmmmmmmmmmm" } 15 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/m0Lg4 on line 9 array(2) { ["nnnnnnn"]=> string(7) "nnnnnnn" ["ooo"]=> string(3) "ooo" } 21 -----

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:
54.57 ms | 425 KiB | 8 Q