3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = <<<END [F] = [] [T] = [[0,0]] [T,T,F,T] = [[0,1],[3,3]] [F,T,T,F,F,T,T,T] = [[1,2],[5,7]] [F,T,T,F,F,F,T,T,T,T] = [[1,2],[6,9]] [T,T,F,F,F,T,T,T,T,T,T,T,T,T,T,F] = [[0,1],[5,14]] [F,F,T,T,F,F,F,F,F,F,F,F,T,T,T,T,T,T,T,T,F,F,F,F,F,F,F,F,F,F,F,F,F,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,T,T] = [[2,3],[12,19],[33,54],[93,94]] END; $tests = []; foreach(explode("\n", $str) as $line) { list($values, $result) = explode('=', $str); $values = explode(',', trim(trim($values), '[]')); $result = eval('return ' . trim($result) . ';'); $tests[] = [$values, $result]; } print_r($tests);
based on IIbhB