3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 請填入本平台提供的 txid 值並填入在單引號內 $txid = '01ffa601e1509d735b5cc32854317a258f8ff0db5836d1c9d0c0340f111c8431'; // 總共幾個大賞 $prize_count = 20; // 總共幾個籤數 $tag_count = 250; $dec = gmp_init($txid, 16); $prize_tmp = []; $prize_tmp_count = 0; $step_tmp = 100; $step = 1; $max_count = 100; try { while ($step <= $max_count) { $powResult = gmp_pow($step_tmp, $step); $div = gmp_div_q($dec, $powResult); $mod = gmp_mod($div, $tag_count); $prize_number = (int)gmp_strval($mod) + 1; if (!in_array($prize_number, $prize_tmp)) { $prize_tmp[] = $prize_number; $prize_tmp_count++; } if ($prize_tmp_count >= $prize_count) { break; } $step++; } echo implode(', ', $prize_tmp); } catch (\Exception $e) { echo $e->getMessage(); }
Output for 8.5.0
Fatal error: Uncaught Error: Call to undefined function gmp_init() in /in/apm1N:11 Stack trace: #0 {main} thrown in /in/apm1N on line 11
Process exited with code 255.
Output for 8.2.0 - 8.2.25, 8.2.27 - 8.2.29, 8.3.0 - 8.3.13, 8.3.15 - 8.3.28, 8.4.2 - 8.4.15
97, 16, 191, 127, 7, 28, 218, 73, 239, 120, 72, 129, 214, 123, 74, 34, 56, 84, 189, 67
Output for 8.2.26, 8.3.14, 8.4.1
Fatal error: Uncaught ValueError: base and exponent overflow in /in/apm1N:24 Stack trace: #0 /in/apm1N(24): gmp_pow(100, 10) #1 {main} thrown in /in/apm1N on line 24
Process exited with code 255.

preferences:
47.38 ms | 414 KiB | 5 Q