I have the follwoing code:
if(isset($riskTriggerFlag) && $riskTriggerFlag==1) // if risk_mitigator process reads and offer weight is maintained based on offer mentioned.
{
echo "Risk Weight: ".$risk_weight ."
";
$randNo = rand(1,100);
echo "Random Weight: ". $randNo ."
";
if($randNo < intval(100 - $risk_weight))
{
$flagThrowPostback = 1;
}
}
As you can see,I am putting in the text,but still the message in getting printed in this matter:
Risk Weight: 20 Random Weight: 20
What am I doing wrong?
I can't use br tag or nl2br() since the total page is just a php page, and I don't want to add any html tags.
output on broswer is coming like this:
<html>
<head></head>
<body>Multiple row Risk Weight: 20 Random Weight: 20 </body>
</html>
I think better way is to check whether php file is executed from CLI or browser. In case it is from browser then use
else newline.
$newline = "<br />";
if (PHP_SAPI === 'cli')
{
// ...
$newline = "
";
}
if(isset($riskTriggerFlag) && $riskTriggerFlag==1) // if risk_mitigator process reads and offer weight is maintained based on offer mentioned.
{
echo "Risk Weight: ".$risk_weight . $newline;
$randNo = rand(1,100);
echo "Random Weight: ". $randNo . $newline;
if($randNo < intval(100 - $risk_weight))
{
$flagThrowPostback = 1;
}
}