# Print Pascal's Triangle [duplicate]

## Overview

Pascal's triangle is the series of rows of numbers, starting with 1, where each cell is formed by summing the two above it. Here's an example.

## Challenge and Scoring

The challenge is simple: given a number, print that many rows of Pascal's Triangle in as few characters as possible. Lowest character count wins. Each row should be separated by newlines, and each number by spaces.

Again, this is code golf: lowest character count wins.

### Example

Given 4, the program should print

1
1 1
1 2 1
1 3 3 1


## Sample solution

<?php
$currentRow = [1];$num = (int)file_get_contents('php://input');
function add($a,$b){
return $a+$b;
}
while($num >0){ echo implode(' ',$currentRow) . "\n";
$currentRow = array_map( 'add', array_merge([0],$currentRow),
array_merge($currentRow, [0]) );$num--;
}