-3

I am familiar with using if else statement but my problem is how to display either if the condition is met.

if ($a == 1) {

echo 'B' OR 'C';  // just for reference

}

I have finally figure this out using nested loop

  if ($a == 1) {
    choiceresult = mt_rand(1,2)

   if (choiceresult == 1) {
      echo 'B';
   }

   if ( choiceresult == 2) {
      echo 'C';
   }

  }
JeVic
  • 681
  • 11
  • 31

1 Answers1

1

you have to fix your condition first :

if($a == 1)

Instead pf

if($a = 1)
cs95
  • 330,695
  • 80
  • 606
  • 657
  • my problem is not the equal but what comes after it whether I use = == === for short how to display one result from – JeVic May 28 '18 at 07:39