3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 請填入本平台提供的 txid 值並填入在單引號內 $txid = 'c19db6709526fe662bf574f886ca22b3a1d44d8a1001ea815c5aceae48e013ff'; // 總共幾個大賞 $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/fEOj5:11 Stack trace: #0 {main} thrown in /in/fEOj5 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
153, 35, 31, 58, 19, 151, 95, 69, 201, 43, 23, 231, 78, 56, 189, 197, 90, 59, 96, 54
Output for 8.2.26, 8.3.14, 8.4.1
Fatal error: Uncaught ValueError: base and exponent overflow in /in/fEOj5:24 Stack trace: #0 /in/fEOj5(24): gmp_pow(100, 10) #1 {main} thrown in /in/fEOj5 on line 24
Process exited with code 255.

preferences:
45.83 ms | 414 KiB | 5 Q