Ragonz Posted January 25, 2018 Share Posted January 25, 2018 So we have a module which accepts custom variables, one of these is an amount of ram. switch ($params["configoptions"]["Extra Ram"]) { case "None": $billing_api_values["gamevar_X"] = "1"; break; } Is there a way I can do a statement that says somthing along the lines of if "configoptions"]["Extra Ram" exists, do below, if not exist check for config option B if not exist check config option c if not exist do following Link to comment Share on other sites More sharing options...
sentq Posted January 25, 2018 Share Posted January 25, 2018 the following IF statement will do what you ask for if (isset($params["configoptions"]["Option A"]) && !empty($params["configoptions"]["Option A"])){ // Do Something } elseif (isset($params["configoptions"]["Option B"]) && !empty($params["configoptions"]["Option B"])){ // Do Something } elseif (isset($params["configoptions"]["Option C"]) && !empty($params["configoptions"]["Option C"])){ // Do Something } else { // No options available do something else } Link to comment Share on other sites More sharing options...
Ragonz Posted January 25, 2018 Author Share Posted January 25, 2018 so somthing like this if (isset($params["configoptions"]["Extra Ram"]) && !empty($params["configoptions"["Extra Ram"])) { case "None": $billing_api_values["gamevar_X"] = "1"; break; case "1GB": $billing_api_values["gamevar_X"] = "1024"; break; case "2GB": $billing_api_values["gamevar_X"] = "2048"; break; } elseif (isset($params["configoptions"]["Ram"]) && !empty($params["configoptions"["Ram"])) { case "512MB": $billing_api_values["gamevar_Xms"] = "512"; $billing_api_values["gamevar_Xmx"] = "512"; break; case "1GB": $billing_api_values["gamevar_Xms"] = "1024"; $billing_api_values["gamevar_Xmx"] = "1024"; break; } else { $billing_api_values["gamevar_X"] = "4096"; } Link to comment Share on other sites More sharing options...
Recommended Posts