如果开关内有其他错误


If else within switch error

你好,我正在使用这行代码:

     case "3rd Year":
                 $lbl="4th Year";
**This is the line**       if( $get_display->gpa => "88" ) {
                                $section_name = 'A';
                            }
                            elseif( $get_display->gpa => "80" ) {
                                $section_name = 'B';
                            }
                            elseif( $get_display->gpa => "75" ) {
                                $section_name = 'C';                      
                            }
                 break;

当前正在散布此错误行:如果有任何帮助,我将不胜感激。

     Parse error: syntax error, unexpected T_DOUBLE_ARROW in C:'xampp'htdocs'Thesis'enrollpage.php on line 293

您应该用>= 替换=>

您正在尝试检查是否大于或等于应该使用的值:

if( $get_display->gpa >= "88" )

或者,如果if语句是一个数组,则您错过了实际的比较:

if( $get_display->gpa['88'] == "something" )

您混合了运算符!您想要使用>=