How To Check String In Switch Case

Share Now

$ball = "8balls";
 switch( $ball ){
	case (string) "9balls":
		echo "NINE BALLS";
		break;
	case (string) 8:
		echo "8 Balls";
		break;
	case (string) "8balls":
		echo "Eight Balls";
		break;
	default:
		echo "Just Balls";
		break;	
 }
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert