Mega Code Archive

 
Categories / Php / Strings
 

String compare with if statement

<html> <head> <title>Decisions</title> </head> <body> <?php      $str_ctrl_flow = "go";          if(!strcmp($str_ctrl_flow, "go")) {           print("string is \"go\"<br />");      } else {           print("Time to stop<br />");           exit;      }          $str_ctrl_flow = "stop";          if(!strcmp($str_ctrl_flow, "go")) {           print("string is \"go\"<br />");      } else {           print("Time to stop<br />");           exit;      } ?> </body> </html>