3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 請填入本平台提供的 txid 值並填入在單引號內 $txid = '4df42992605542f9ecd119d197c6fa4420cd39d9610333b2e59df09d2dba35b2'; // 總共幾個大賞 $prize_count = 1; // 總共幾個籤數 $tag_count = 40; $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 - 8.5.3
Fatal error: Uncaught Error: Call to undefined function gmp_init() in /in/h100t:11 Stack trace: #0 {main} thrown in /in/h100t on line 11
Process exited with code 255.
Output for 8.1.34, 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
36

preferences:
39.93 ms | 707 KiB | 4 Q