<?php
class Queue {
public $number = array();
public $index = -1;
public function is_empty(){
if($this->index == -1){
return true;
}
return false;
}
public function push($element)
{
$this->index++;
$this->number[$this->index] = $element;
}
public function pop_from_last(){
return array_shift($this->number);
}
}
$person = new Queue();
$person->push(2);
$person->push(4);
$person->push(8);
$person->push(9);
print_r($person->number);
echo '<br>';
echo $person->pop_from_last();
echo '<br>';
print_r($person->number);
class Queue {
public $number = array();
public $index = -1;
public function is_empty(){
if($this->index == -1){
return true;
}
return false;
}
public function push($element)
{
$this->index++;
$this->number[$this->index] = $element;
}
public function pop_from_last(){
return array_shift($this->number);
}
}
$person = new Queue();
$person->push(2);
$person->push(4);
$person->push(8);
$person->push(9);
print_r($person->number);
echo '<br>';
echo $person->pop_from_last();
echo '<br>';
print_r($person->number);