<?php /** * This class enables use of scalar values with classes implementing iComparable * $Id: boxed_scalars.php,v 1.1 2006-12-03 23:20:08 marand Exp $ */ require_once('misc.php'); // for iComparable class boxed_int implements iComparable { protected $value; function __construct($n) { $this->value = $n; } function cmp(iComparable $other) { if ($this->value < $other->value) return -1; elseif ($this->value > $other->value) return 1; else return 0; } function as_int() { return $this->value; } }