# 3v4l.org

run code in 150+ php & hhvm versions
```<?php echo whole_fraction(23.54); function whole_fraction(\$decimal){ \$big_fraction = float2rat(\$decimal); \$num_array = explode('/', \$big_fraction); echo \$big_fraction; \$numerator = \$num_array[0]; \$denominator = \$num_array[1]; echo "\n"; echo \$numerator; echo "\n"; echo \$denomenator; \$whole_number = floor( \$numerator / \$denominator ); \$numerator = \$numerator % \$denomenator; \$fraction = \$whole_number . ' ' . \$numerator . '/' . \$denomenator; } function float2rat(\$n, \$tolerance = 1.e-6) { \$h1=1; \$h2=0; \$k1=0; \$k2=1; \$b = 1/\$n; do { \$b = 1/\$b; \$a = floor(\$b); \$aux = \$h1; \$h1 = \$a*\$h1+\$h2; \$h2 = \$aux; \$aux = \$k1; \$k1 = \$a*\$k1+\$k2; \$k2 = \$aux; \$b = \$b-\$a; } while (abs(\$n-\$h1/\$k1) > \$n*\$tolerance); return "\$h1/\$k1"; }```
based on hWjot
Output for 7.0.0 - 7.1.0RC3
1177/50 1177 Notice: Undefined variable: denomenator in /in/aUZh5 on line 15 Notice: Undefined variable: denomenator in /in/aUZh5 on line 17 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/aUZh5:17 Stack trace: #0 /in/aUZh5(2): whole_fraction(23.54) #1 {main} thrown in /in/aUZh5 on line 17
Process exited with code 255.
Output for 5.2.0 - 5.6.21, hhvm-3.12.0
1177/50 1177 Notice: Undefined variable: denomenator in /in/aUZh5 on line 15 Notice: Undefined variable: denomenator in /in/aUZh5 on line 17 Warning: Division by zero in /in/aUZh5 on line 17 Notice: Undefined variable: denomenator in /in/aUZh5 on line 18
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.4 - 5.1.6
1177/50 1177 Notice: Undefined variable: denomenator in /in/aUZh5 on line 15 Notice: Undefined variable: denomenator in /in/aUZh5 on line 17 Notice: Undefined variable: denomenator in /in/aUZh5 on line 18
Output for 4.3.0 - 4.4.4, 5.0.0 - 5.0.3
1177/50 1177 Notice: Undefined variable: denomenator in /in/aUZh5 on line 15 Notice: Undefined variable: denomenator in /in/aUZh5 on line 17 Notice: Undefined variable: denomenator in /in/aUZh5 on line 18
Output for 4.4.5 - 4.4.9
1177/50 1177 Notice: Undefined variable: denomenator in /in/aUZh5 on line 15 Notice: Undefined variable: denomenator in /in/aUZh5 on line 17 Warning: Division by zero in /in/aUZh5 on line 17 Notice: Undefined variable: denomenator in /in/aUZh5 on line 18