This simple php script uses a php array named $lover to store the names of two famous women – Beyonce Knowles and Halle Berry.
The php variable $wife is used to store the first value in the $lover array which is Beyonce, who is Jay-Z’s wife.
If there is more than one woman ($benchmark = 1) in the $lover array, then Jay-Z is considered to be a cheater with whomever else is in the $lover array.
If there are two women in the $lover array but the $other_woman is just a friend or associate, ($benchmark = 2), then Jay-Z is considered to be faithful to his $wife.
$lover = ‘Beyonce Knowles’;
$lover = ‘Halle Berry’;
$benchmark = 1;
$husband = ‘Jay-Z’;
$wife = $lover;
$other_woman = $lover;
$phparraylength = count($lover);
$i = 0;
while($i < $phparraylength):
echo $i + 1;
echo ‘. ‘;
echo ‘<br />’;
if($phparraylength > $benchmark):
$message = “$husband is cheating on his wife $wife with $other_woman!”;
elseif($phparraylength == $benchmark):
$message = “$husband is being faithful to his wife $wife and $other_woman was a false rumor!”;