<?php function multiply_two_lists($x, $y) { $a = explode(' ',trim($x)); $b = explode(' ',trim($y)); foreach($a as $key=>$value) { $output[$key] = $a[$key]*$b[$key]; } return implode(' ',$output); } echo multiply_two_lists(("10 12 3"), ("1 3 3"))."\n"; ?>
<?php for ($i = 1; $i < 7; $i++) { for ($j = 1; $j < 7; $j++) { if ($j == 1) { echo str_pad($i*$j, 2, " ", STR_PAD_LEFT); } else { echo str_pad($i*$j, 4, " ", STR_PAD_LEFT); } } echo "\n"; } ?>