PHP Implementation of stack

During my recent study of data structures I decided to write a few implementations of popular data structures that are not provided by PHP. Below you can find my first implementation of stack data structure.

 

<?php

class stack {

    private $stack = array();

    function push($value) {
        $this->stack[] = $value;
    }

    function pop() {
        if ($this->isEmpty())
        {
            throw new RunTimeException("Stack is empty");
        }
        $top = $this->stack[count($this->stack) - 1];
        unset($this->stack[count($this->stack) - 1]);
        $this->stack = array_values($this->stack);
        return $top;
    }

    function isEmpty() {
        return empty($this->stack) ? true : false;
    }

    function peak() {
        $top = $this->stack[count($this->stack)];
        return $top;
    }

    function printr() {
        print_r($this->stack);
    }

}