I want to use php to make a Monty Hall question. How do you write the logic?

this is the java version of logic

import java.util.Random;  
  
  
public class MengTeHuoEr {  
  
    public static void main(String[] args) {  
          
        boolean[] a = new boolean[3];//  
        Random random = new Random();  
        int N = 10000;  
        int count = 0;  
          
        for(int i = 0; i < N; iPP){//N  
              
            for(int j = 0; j < 3; jPP)  
                a[j] = false;  
            int indexOfCar = random.nextInt(3);//  
            a[indexOfCar] = true;  
              
            int indexOfChoose = random.nextInt(3);//  
              
            int indexOfOpen;//  
            for(indexOfOpen = 0; indexOfOpen < 3; indexOfOpenPP){  
                if(indexOfOpen != indexOfCar && indexOfOpen != indexOfChoose)  
                    break;  
            }  
            int indexOfChange;//  
            for(indexOfChange = 0; indexOfChange < 3; indexOfChangePP){  
                if(indexOfChange != indexOfOpen && indexOfChange != indexOfChoose)  
                    break;  
            }  
            indexOfChoose = indexOfChange;  
            if(a[indexOfChoose] == true)  
                countPP;  
        }  
        System.out.println(count*1.0/N);  
          
    }  
  
}  

for more information, please see

from Baidu.
Mar.01,2021

$a = array(false, false, false);
        $N = 10000;
        $count = 0;
        for ($i = 0; $i < $N; $iPP) {
            for ($j = 0; $j < 3; $jPP) {
                $a[$j] = false;
            }
            $indexOfCar = rand(0, 2); //
            $a[$indexOfCar] = true;
            $indexOfChoose = rand(0, 2); //  
            $indexOfOpen = 0;
            for ($indexOfOpen = 0; $indexOfOpen < 3; $indexOfOpenPP) {
                if ($indexOfOpen != $indexOfCar && $indexOfOpen != $indexOfChoose) {
                    break;
                }
            }
            $indexOfChange = 0; //  
            for ($indexOfChange = 0; $indexOfChange < 3; $indexOfChangePP) {
                if ($indexOfChange != $indexOfOpen && $indexOfChange != $indexOfChoose)
                    break;
            }
            $indexOfChoose = $indexOfChange;
            if ($a[$indexOfChoose] == true) {
                $countPP;
            }
        }
        echo $count * 1.0 / $N;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5e056-5a7c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5e056-5a7c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?