Jump to content

anybody see anything wrong with this code? array not unsetting


youngnate

Recommended Posts

so im developing a WEB GAME etc.... etc.... and im including a page that has functions on it in another page if that makes sense....<br>

so here's my code tell me why i cant get theese array  values to clear?

function unlockables(){
// restore the content

$unlockables = array(
	'ach'=>array(
		// achevements unlockables
		md5(0)=>array('key'=>md5(0),'title'=>'novice','cash'=>'1000',  'exp'=>'100000', 'lvl'=>'20'),
		md5(1)=>array('key'=>md5(1),'title'=>'rookie','cash'=>'5000',  'exp'=>'150000', 'lvl'=>'40'),
		md5(2)=>array('key'=>md5(2),'title'=>'pro','cash'=>'10000', 'exp'=>'250000', 'lvl'=>'60'),
		md5(3)=>array('key'=>md5(3),'title'=>'king','cash'=>'50000', 'exp'=>'500000', 'lvl'=>'80'),
		md5(4)=>array('key'=>md5(4),'title'=>'Morphelo','cash'=>'100000','exp'=>'1000000','lvl'=>'100'),
	),
	'levels'=>array(
		// lvl up
		md5(5)=>array('key'=>md5(5),'price'=>'1000',  'lvlup'=>'1'),
		md5(6)=>array('key'=>md5(6),'price'=>'4000',  'lvlup'=>'5'),
		md5(7)=>array('key'=>md5(7),'price'=>'7500', 'lvlup'=>'10'),
		md5(=>array('key'=>md5(,'price'=>'15000', 'lvlup'=>'25'),
		md5(9)=>array('key'=>md5(9),'price'=>'25000', 'lvlup'=>'50')
	),
	'exp'=>array(
		// exp up
		md5(10)=>array('key'=>md5(10),'price'=>'100','expup'=>'500'),
		md5(11)=>array('key'=>md5(11),'price'=>'1000','expup'=>'6000'),
		md5(12)=>array('key'=>md5(12),'price'=>'10000','expup'=>'75000'),
		md5(13)=>array('key'=>md5(13),'price'=>'50000','expup'=>'375000'),
		md5(14)=>array('key'=>md5(14),'price'=>'100000','expup'=>'750000')
	)
);

if($_COOKIE['lvl'] >= 0 && $_COOKIE['lvl'] < 20) {
	// first snakes
	$status = 'fs';	
}elseif($_COOKIE['lvl'] >= 20 && $_COOKIE['lvl'] < 40){
	// Novice
	$status = 'novice';	
}elseif($_COOKIE['lvl'] >= 40 && $_COOKIE['lvl'] < 60){
	// Rookie
	$status = 'rook';	
}elseif($_COOKIE['lvl'] >= 60 && $_COOKIE['lvl'] < 80){
	// pro
	$status = 'pro';	
}elseif($_COOKIE['lvl'] >= 80 && $_COOKIE['lvl'] < 100){
	// Novice
	$status = 'king';	
}elseif($_COOKIE['lvl'] >= 100){
	// Novice
	$status = 'morphelo';	
}
  	
	switch($status){
		case 'novice':
		unset(
			$unlockables['ach'][md5(0)],
			$unlockables['ach'][md5(2)],
			$unlockables['ach'][md5(3)],
			$unlockables['ach'][md5(4)]
		);
		break;
		case 'rook':
		unset(
			$unlockables['ach'][md5(0)],
			$unlockables['ach'][md5(1)],
			$unlockables['ach'][md5(3)],
			$unlockables['ach'][md5(4)]
		);
		break;
		case 'pro':
		unset(
			$unlockables['ach'][md5(0)],
			$unlockables['ach'][md5(1)],
			$unlockables['ach'][md5(2)],
			$unlockables['ach'][md5(4)]
		);
		break;
		case 'king':
		unset(
			$unlockables['ach'][md5(0)],
			$unlockables['ach'][md5(1)],
			$unlockables['ach'][md5(2)],
			$unlockables['ach'][md5(3)]
		);
		break;
		case 'morphelo':
		unset($unlockables['ach']);
		break;
	}
// here is were im trying print to screen but the array is still printing full
	print_r($unlockables['ach']);
}

:confused:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.