3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = 'ab.cd.ef.gh.ij.kl.mn.op.qr'; $split = array_map( function($value) { return implode('.', $value); }, array_chunk(explode('.', $string), 2) ); var_dump($split);
based on pI7Rv
Output for 5.3.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.0 - 7.2.8
array(5) { [0]=> string(5) "ab.cd" [1]=> string(5) "ef.gh" [2]=> string(5) "ij.kl" [3]=> string(5) "mn.op" [4]=> string(2) "qr" }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/fe4kt on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/fe4kt on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/fe4kt on line 6
Process exited with code 255.