3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo convert_fraction_to_decimal('3 1/32'); 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 = $whole_number + $fraction_decimal; return $return_number; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U1lm5
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'convert_fraction_to_decimal'
          1        SEND_VAL_EX                                              '3+1%2F32'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   17     4      > RETURN                                                   1

Function convert_fraction_to_decimal:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/U1lm5
function name:  convert_fraction_to_decimal
number of ops:  26
compiled vars:  !0 = $fraction_string, !1 = $fraction_string_array, !2 = $whole_number, !3 = $fraction_number, !4 = $fraction_decimal, !5 = $fraction_number_array, !6 = $return_number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    7     6        FETCH_DIM_R                                      ~9      !1, 0
          7        ASSIGN                                                   !2, ~9
    8     8        FETCH_DIM_R                                      ~11     !1, 1
          9        ASSIGN                                                   !3, ~11
    9    10        ASSIGN                                                   !4, 0
   10    11        IS_NOT_EQUAL                                             !3, 0
         12      > JMPZ                                                     ~14, ->22
   11    13    >   INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '%2F'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $15     
         17        ASSIGN                                                   !5, $15
   12    18        FETCH_DIM_R                                      ~17     !5, 0
         19        FETCH_DIM_R                                      ~18     !5, 1
         20        DIV                                              ~19     ~17, ~18
         21        ASSIGN                                                   !4, ~19
   14    22    >   ADD                                              ~21     !2, !4
         23        ASSIGN                                                   !6, ~21
   16    24      > RETURN                                                   !6
   17    25*     > RETURN                                                   null

End of function convert_fraction_to_decimal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166 ms | 1396 KiB | 15 Q