Jump to content

if in switch problem


PhpxZ

Recommended Posts

I have a problem with the if in my function

the if in switch

 

function IsValidSkin($skinid) {
switch ($skinid) {
	case 3; case 4; case 5; case 6; case 8; case 17; case 42; case 50; case 61; case 65; case 71; case 74; case 86; case 92; case 268; case 99; case 119; case 149; 
if($row['Sex'] == "1")  echo' case14';
		return false;
		break;
}	
return true;
}

 

The if isn't work.

what is the problem?

 

Link to comment
https://forums.phpfreaks.com/topic/206335-if-in-switch-problem/
Share on other sites

Where are you pulling the $row['Sex'] from? How are you comparing the IsValidSkin function to $row['Sex']?

 

<?php

function IsValidSkin($skinid,$sex){

$valid = array(3,4,5,6,8,17,42,50,61,65,71,74,86,92,268,119,149);
if(in_array($skinid,$valid)){
	return true;
}else {
	if($sex == 1){
		return true;
	}else {
		return false;
	}
}
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.