3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo convert_fraction_to_decimal('3 1/16'); function convert_fraction_to_decimal( $fraction_string){ $fraction_string_array = explode( ' ', $fraction_string); $whole_number = $fraction_string_array[0]; $fraction_number = $fraction_string_array[1]; $fraction_decimal = 0; if( $fraction_number != 0){ $fraction_number_array = explode($fraction_number, '/'); $fraction_decimal = $fraction_number_array[0] / $fraction_number_array[1]; } $return_number = $fraction_number + $fraction_decimal; return $return_number; }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 1 in /in/G14Ha on line 12 Fatal error: Uncaught TypeError: Unsupported operand types: string / null in /in/G14Ha:12 Stack trace: #0 /in/G14Ha(3): convert_fraction_to_decimal('3 1/16') #1 {main} thrown in /in/G14Ha on line 12
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.04 ms | 401 KiB | 8 Q