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>
Related examples in the same category