All pastes #926380 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-03 18:06 UTC
rendered paste body
Function XYpairs(){
	$back = 0;
	if (isset($_SESSION["path"])){
		for ($i = 0; $i < count($_SESSION["path"]) ; $i++) {
			if (($_SESSION["path"][$i]["x"] == $this->x) && ($_SESSION["path"][$i]["y"] == $this->y)) {
				$_SESSION["path"] = array_slice($_SESSION["path"],0,$i);
				$back = 1;
				$i = count($_SESSION["path"]);
			}
		}
		if ($back == 0){
			$curentindex = count($_SESSION["path"]);
			$_SESSION["path"][$curentindex]["x"] = $this->x;
			$_SESSION["path"][$curentindex]["y"] = $this->y;
		}
	} else {
		$_SESSION["path"][0]["x"] = "TOPPATH";
		$_SESSION["path"][0]["y"] = $this->y;
	}
	print_r($_SESSION["path"]);
}