3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $line = "HELLO WORLD HOW ARE YOU I AM JUST FINE THANKS"; $plan = [9, 20]; var_dump(plan_split($line, $plan)); function plan_split(string $line, array $plan) : array { preg_match('/(.{' . implode('})(.{', $plan) . '})(.*)/s', $line, $m); array_shift($m); return $m; }
based on hWYmN
Output for hhvm-3.12.14 - 3.17.3, 7.0.0 - 7.2.6
array(3) { [0]=> string(9) "HELLO " [1]=> string(20) "WORLD HOW ARE YOU " [2]=> string(21) "I AM JUST FINE THANKS" }
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/pv759 on line 10
Process exited with code 255.