1--TEST-- 2bcdivmod() function div by zero 3--EXTENSIONS-- 4bcmath 5--INI-- 6bcmath.scale=0 7--FILE-- 8<?php 9require(__DIR__ . "/run_bcmath_tests_function.inc"); 10 11$dividends = [ 12 "15", "-15", "1", "-9", "14.14", "-16.60", "0.15", "-0.01", 13 "15151324141414.412312232141241", 14 "-132132245132134.1515123765412", 15 "141241241241241248267654747412", 16 "-149143276547656984948124912", 17 "0.1322135476547459213732911312", 18 "-0.123912932193769965476541321", 19]; 20 21$divisors = [ 22 '0', 23 '0.00', 24]; 25 26foreach ($dividends as $firstTerm) { 27 foreach ($divisors as $secondTerm) { 28 try { 29 bcdivmod($firstTerm, $secondTerm); 30 echo "NG\n"; 31 } catch (Error $e) { 32 echo $e->getMessage() === 'Division by zero' ? 'OK' :'NG'; 33 echo "\n"; 34 } 35 } 36} 37?> 38--EXPECT-- 39OK 40OK 41OK 42OK 43OK 44OK 45OK 46OK 47OK 48OK 49OK 50OK 51OK 52OK 53OK 54OK 55OK 56OK 57OK 58OK 59OK 60OK 61OK 62OK 63OK 64OK 65OK 66OK 67