Re: PHP Class ArrayQueue (2)
| From: | Marek Kilimajer | Date: | Thu, 16 Oct 2003 14:44:16 +0000 |
| Subject: | Re: PHP Class ArrayQueue (2) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166302@lists.php.net to get a copy of this message | ||
You need to read manual section about object oriented programing in php:
http://www.php.net/oop
Antonio Bologna wrote:
Sorry, here it is the code: <?php /* Trying to use queues in PHP, let * see if that works. */ class ArrayQueue { var $theArray = array(); var $currentSize; var $front; var $back; var $DEFAULT_CAPACITY = 10; function increment($x) { if(++$x == $theArray.length)$x = 0;return $x; } function ArrayQueue() { $theArray = ($DEFAULT_CAPACITY); ArrayQueue::makeEmpty(); } function isEmpty() { return $currentSize = 0; } function enqueue($Obj) { if($currentSize == $theArray.length)ArrayQueue::doubleQueue();$back = ArrayQueue::increment($back); $theArray[$back] = $Obj; $currentSize++; } function makeEmpty() { $currentSize = 0; $front = 0; $back = -1; } function objReturn() { return $front; } }