<?php

function fn_reverse_a($aql)
{
	$data = $aql->Consume(1);
	$points = $data[0];
	$newset = array();
	
	for($x=count($points->value)-1;$x>=0;$x--)
	{
		$newset[] = $points->value[$x];
	}	
		
	$points->value = $newset;
		
	array_push($aql->stack,$points);
}

function fn_reverse_p($aql)
{
	$data = $aql->Consume(1);
	$points = $data[0];
	$newset = array();
	
	for($x=count($points->value)-1;$x>=0;$x--)
	{
		$newset[] = $points->value[$x];
	}	
		
	$points->value = $newset;
		
	array_push($aql->stack,$points);
}

function fn_reverse_r($aql)
{
	$data = $aql->Consume(1);
	$points = $data[0];
	$newset = array();
	
	for($x=count($points->value)-1;$x>=0;$x--)
	{
		$newset[] = $points->value[$x];
	}	
		
	$points->value = $newset;
		
	array_push($aql->stack,$points);
}

function fn_reverse_c($aql)
{
	$data = $aql->Consume(1);
	$points = $data[0];
	$newset = array();
	
	if (!is_array($points->value))
	{		
		$v = $points->value;
		$points->value = array();
		$points->value[] = $v;
	}
	
	for($x=count($points->value)-1;$x>=0;$x--)
	{
		$newset[] = $points->value[$x];
	}	
		
	$points->value = $newset;
		
	array_push($aql->stack,$points);
}

?>