/** * Destructor. */ public function __destruct() { parent::__destruct(); }
public function __construct($debug = FALSE) { parent::__construct(); $this->size = 0; }
} printf("%s\n", str($queue)); printf("Using reduce\n"); $queue->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), ''); printf("Using foreach\n"); foreach ($queue as $obj) { printf("%s\n", str($obj)); } printf("getHead\n"); printf("%s\n", str($queue->getHead())); printf("Dequeueing\n"); while (!$queue->isEmpty()) { printf("%s\n", str($queue->dequeue())); } } /** * Main program. * * @param array $args Command-line arguments. * @return integer Zero on success; non-zero on failure. */ public static function main($args) { printf("AbstractQueue main program.\n"); $status = 0; return $status; } } if (realpath($argv[0]) == realpath(__FILE__)) { exit(AbstractQueue::main(array_slice($argv, 1))); }
/** * Main program. * * @param array $args Command-line arguments. * @return integer Zero on success; non-zero on failure. */ public static function main($args) { printf("QueueAsArray main program.\n"); $status = 0; $queue = new QueueAsArray(5); AbstractQueue::test($queue); return $status; }
public function __construct() { parent::__construct('array_push', 'array_pop'); }