3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $n = array ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ); $i = 10; foreach($n as $num) { print(str_pad("$num", 2, ' ')); print(' | '); for($x=1;$x<=$i;$x++) { $d = number_format($num/$x, 2, ',', '.'); $a = "$num/$x"; $b = "= $d"; print(str_pad($a, 5, ' ')); print(str_pad($b, 8, ' ')); print(str_pad('| ', 2, ' ')); } print(str_pad("\n", (15*$i)+5, '-')); print("\n"); }
Output for 4.3.2 - 7.1.0
1 | 1/1 = 1,00 | 1/2 = 0,50 | 1/3 = 0,33 | 1/4 = 0,25 | 1/5 = 0,20 | 1/6 = 0,17 | 1/7 = 0,14 | 1/8 = 0,13 | 1/9 = 0,11 | 1/10 = 0,10 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 2 | 2/1 = 2,00 | 2/2 = 1,00 | 2/3 = 0,67 | 2/4 = 0,50 | 2/5 = 0,40 | 2/6 = 0,33 | 2/7 = 0,29 | 2/8 = 0,25 | 2/9 = 0,22 | 2/10 = 0,20 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 3 | 3/1 = 3,00 | 3/2 = 1,50 | 3/3 = 1,00 | 3/4 = 0,75 | 3/5 = 0,60 | 3/6 = 0,50 | 3/7 = 0,43 | 3/8 = 0,38 | 3/9 = 0,33 | 3/10 = 0,30 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 4 | 4/1 = 4,00 | 4/2 = 2,00 | 4/3 = 1,33 | 4/4 = 1,00 | 4/5 = 0,80 | 4/6 = 0,67 | 4/7 = 0,57 | 4/8 = 0,50 | 4/9 = 0,44 | 4/10 = 0,40 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 5 | 5/1 = 5,00 | 5/2 = 2,50 | 5/3 = 1,67 | 5/4 = 1,25 | 5/5 = 1,00 | 5/6 = 0,83 | 5/7 = 0,71 | 5/8 = 0,63 | 5/9 = 0,56 | 5/10 = 0,50 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 6 | 6/1 = 6,00 | 6/2 = 3,00 | 6/3 = 2,00 | 6/4 = 1,50 | 6/5 = 1,20 | 6/6 = 1,00 | 6/7 = 0,86 | 6/8 = 0,75 | 6/9 = 0,67 | 6/10 = 0,60 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 7 | 7/1 = 7,00 | 7/2 = 3,50 | 7/3 = 2,33 | 7/4 = 1,75 | 7/5 = 1,40 | 7/6 = 1,17 | 7/7 = 1,00 | 7/8 = 0,88 | 7/9 = 0,78 | 7/10 = 0,70 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 8 | 8/1 = 8,00 | 8/2 = 4,00 | 8/3 = 2,67 | 8/4 = 2,00 | 8/5 = 1,60 | 8/6 = 1,33 | 8/7 = 1,14 | 8/8 = 1,00 | 8/9 = 0,89 | 8/10 = 0,80 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 9 | 9/1 = 9,00 | 9/2 = 4,50 | 9/3 = 3,00 | 9/4 = 2,25 | 9/5 = 1,80 | 9/6 = 1,50 | 9/7 = 1,29 | 9/8 = 1,13 | 9/9 = 1,00 | 9/10 = 0,90 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 10 | 10/1 = 10,00 | 10/2 = 5,00 | 10/3 = 3,33 | 10/4 = 2,50 | 10/5 = 2,00 | 10/6 = 1,67 | 10/7 = 1,43 | 10/8 = 1,25 | 10/9 = 1,11 | 10/10= 1,00 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 11 | 11/1 = 11,00 | 11/2 = 5,50 | 11/3 = 3,67 | 11/4 = 2,75 | 11/5 = 2,20 | 11/6 = 1,83 | 11/7 = 1,57 | 11/8 = 1,38 | 11/9 = 1,22 | 11/10= 1,10 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 12 | 12/1 = 12,00 | 12/2 = 6,00 | 12/3 = 4,00 | 12/4 = 3,00 | 12/5 = 2,40 | 12/6 = 2,00 | 12/7 = 1,71 | 12/8 = 1,50 | 12/9 = 1,33 | 12/10= 1,20 | ----------------------------------------------------------------------------------------------------------------------------------------------------------
Output for 4.3.0 - 4.3.1
1 | 1/1 = 1,00 | 1/2 = 0,50 | 1/3 = 0,33 | 1/4 = 0,25 | 1/5 = 0,20 | 1/6 = 0,17 | 1/7 = 0,14 | 1/8 = 0,12 | 1/9 = 0,11 | 1/10 = 0,10 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 2 | 2/1 = 2,00 | 2/2 = 1,00 | 2/3 = 0,67 | 2/4 = 0,50 | 2/5 = 0,40 | 2/6 = 0,33 | 2/7 = 0,29 | 2/8 = 0,25 | 2/9 = 0,22 | 2/10 = 0,20 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 3 | 3/1 = 3,00 | 3/2 = 1,50 | 3/3 = 1,00 | 3/4 = 0,75 | 3/5 = 0,60 | 3/6 = 0,50 | 3/7 = 0,43 | 3/8 = 0,38 | 3/9 = 0,33 | 3/10 = 0,30 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 4 | 4/1 = 4,00 | 4/2 = 2,00 | 4/3 = 1,33 | 4/4 = 1,00 | 4/5 = 0,80 | 4/6 = 0,67 | 4/7 = 0,57 | 4/8 = 0,50 | 4/9 = 0,44 | 4/10 = 0,40 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 5 | 5/1 = 5,00 | 5/2 = 2,50 | 5/3 = 1,67 | 5/4 = 1,25 | 5/5 = 1,00 | 5/6 = 0,83 | 5/7 = 0,71 | 5/8 = 0,62 | 5/9 = 0,56 | 5/10 = 0,50 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 6 | 6/1 = 6,00 | 6/2 = 3,00 | 6/3 = 2,00 | 6/4 = 1,50 | 6/5 = 1,20 | 6/6 = 1,00 | 6/7 = 0,86 | 6/8 = 0,75 | 6/9 = 0,67 | 6/10 = 0,60 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 7 | 7/1 = 7,00 | 7/2 = 3,50 | 7/3 = 2,33 | 7/4 = 1,75 | 7/5 = 1,40 | 7/6 = 1,17 | 7/7 = 1,00 | 7/8 = 0,88 | 7/9 = 0,78 | 7/10 = 0,70 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 8 | 8/1 = 8,00 | 8/2 = 4,00 | 8/3 = 2,67 | 8/4 = 2,00 | 8/5 = 1,60 | 8/6 = 1,33 | 8/7 = 1,14 | 8/8 = 1,00 | 8/9 = 0,89 | 8/10 = 0,80 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 9 | 9/1 = 9,00 | 9/2 = 4,50 | 9/3 = 3,00 | 9/4 = 2,25 | 9/5 = 1,80 | 9/6 = 1,50 | 9/7 = 1,29 | 9/8 = 1,12 | 9/9 = 1,00 | 9/10 = 0,90 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 10 | 10/1 = 10,00 | 10/2 = 5,00 | 10/3 = 3,33 | 10/4 = 2,50 | 10/5 = 2,00 | 10/6 = 1,67 | 10/7 = 1,43 | 10/8 = 1,25 | 10/9 = 1,11 | 10/10= 1,00 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 11 | 11/1 = 11,00 | 11/2 = 5,50 | 11/3 = 3,67 | 11/4 = 2,75 | 11/5 = 2,20 | 11/6 = 1,83 | 11/7 = 1,57 | 11/8 = 1,38 | 11/9 = 1,22 | 11/10= 1,10 | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 12 | 12/1 = 12,00 | 12/2 = 6,00 | 12/3 = 4,00 | 12/4 = 3,00 | 12/5 = 2,40 | 12/6 = 2,00 | 12/7 = 1,71 | 12/8 = 1,50 | 12/9 = 1,33 | 12/10= 1,20 | ----------------------------------------------------------------------------------------------------------------------------------------------------------