PHP String Compare With If Statement – String Function

 
    <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>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.