<?php
function rpn($postFix){
    $stack = Array();
    echo  ;
	$token = explode(, trim($postFix));
	$count = count($token);

    for($i = 0 ; $i<$count;$i++)
	{
        echo $token[$i] .;
        $tokenNum = ;

        if (is_numeric($token[$i])) {
            echo  ;
			array_push($stack,$token[$i]);
        }
        else
        {
            echo ;
            $secondOperand = end($stack);
			array_pop($stack);
            $firstOperand = end($stack);
            array_pop($stack);

            if ($token[$i] == )
				array_push($stack,$firstOperand * $secondOperand);
            else if ($token[$i] == )
                array_push($stack,$firstOperand / $secondOperand);
            else if ($token[$i] == )
                array_push($stack,$firstOperand - $secondOperand);
            else if ($token[$i] == )
                array_push($stack,$firstOperand + $secondOperand);
            else if ($token[$i] == )
                array_push($stack,pow($firstOperand,$secondOperand));
            else {
                die();
            }
        }
		echo  . implode(, $stack) .  ;
    }
    return end($stack);
} 

echo  . rpn();
?>