3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ "5'", "5' 0", "5' 0 1/2", "5' 1", "5' 1 1/2", "5' 2", "5' 2 1/2", "7' 4", ]; foreach ($tests as $test) { sscanf($test, '%d\' %d %d/%d"', $feet, $inches, $numerator, $denominator); printf("%.1f\n", ($feet * 12) + $inches + ($denominator ? $numerator / $denominator : 0)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 24
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/BZaoS
function name:  (null)
number of ops:  26
compiled vars:  !0 = $tests, !1 = $test, !2 = $feet, !3 = $inches, !4 = $numerator, !5 = $denominator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1      > FE_RESET_R                                       $7      !0, ->24
          2    > > FE_FETCH_R                                               $7, !1, ->24
   15     3    >   INIT_FCALL                                               'sscanf'
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 '%25d%27+%25d+%25d%2F%25d%22'
          6        SEND_REF                                                 !2
          7        SEND_REF                                                 !3
          8        SEND_REF                                                 !4
          9        SEND_REF                                                 !5
         10        DO_ICALL                                                 
   16    11        INIT_FCALL                                               'printf'
         12        SEND_VAL                                                 '%25.1f%0A'
         13        MUL                                              ~9      !2, 12
         14        ADD                                              ~10     ~9, !3
         15      > JMPZ                                                     !5, ->19
         16    >   DIV                                              ~11     !4, !5
         17        QM_ASSIGN                                        ~12     ~11
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~12     0
         20    >   ADD                                              ~13     ~10, ~12
         21        SEND_VAL                                                 ~13
         22        DO_ICALL                                                 
   14    23      > JMP                                                      ->2
         24    >   FE_FREE                                                  $7
   17    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.31 ms | 1000 KiB | 15 Q