I have an array with some words that if they match the word they receive from the GET they print a message, but sometimes it doesn't work because it doesn't match the capitals, is there any way to ignore the capitals and minicules? :( and sorry I'm very new to php, this php is for a command in twitch :)
<?php
> $so = $_GET["option"];
$default = 'Go check out $(touser) at twitch.tv/$(touser) and go show them some love ';
if(isset($so) && $so != ""){
$prefix = "Go check out my great friend who is part of our crew and go show them some love in twitch.tv/";
> $channel = array(
"gusbars(example)" => $prefix."gusbars/",
"vicent" => $prefix."viventtv/",
"smoxx" => $prefix."smoxxao/",
"tecno" => $prefix."tecnoteam/"
);
if(array_key_exists($so, $channel)){
echo $channel[$so];
}else if($so == "list"){
foreach ($channel as $a_so => $value){
echo $a_so." | ";
}
}else{
echo $default;
}
}else{
echo $idefault;
}
?>
You could use PHP's strtolower() function to be sure the variable you are trying to match/compare is always a consistent case. E.g.
$so = strtolower($_GET["option"]);