Hello, Need help in PHP coding on the function Function Defined as "License Type" => array( "Type" => "dropdown", "Options" => "cPanel VPS License,cPanel Dedicated License, Softaculous VPS, Softaculous Dedicated" ), Where cPanel VPS License = 2 cPanel Dedicated License = 1 Softaculous VPS = 8 Softaculous Dedicated = 7 And i another Line above License Type called by using the code $license_type = License Type == "cPanel VPS License" ? "2" : "1"; Work only for first two If want to add another two functions that os Softaculous VPS and Dedicated such as $license_type = License Type == "cPanel VPS License" ? "2" : "1" : "8" : "7"; Then it not working so in short if we want to call more that 2 functions then how can it possible as call of two functions are working that is with 2 and 1 not 2,1,8,7 so can any one say how to fix it. Regards
Hello, The ternanry operators is mostly used for two values the one which is true and other is false , not sure if it works for four values instead you can try if condition.
The ternary if means if license type is equal to cpanel vps license, make $license_type 2, otherwise make it 1. Since there are only 2 possible conditions (it is equal or it's not equal), you can have only 2 values. If you have other conditions to test you can add values, but you can't set one of 4 values based on one condition being true or false - that's only two choices.