3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <html> <head> <title> Average</title> </head> <body> <?php $fname=$_GET["fname"]; $lname=$_GET["lname"]; $test1=$_GET["sub1"]; $test2=$_GET["sub2"]; $test3=$_GET["sub3"]; //subject information $avg = average($sub1, $sub2, $sub3); $lg = lettergrade($avg); fname(); lname(); $sub1 = sub1($avg); $sub2 = sub2($avg); $sub3 = sub3($avg); avg(); function fname() {print "First Name:"; print $fname; print "<br>"; print "<br>"; } function lname() {print "Last Name:"; print "<br>"; print "<br>"; } function sub1() {print "sub 1"; print "<br>"; print "<br>"; } function sub2() {print "sub 2"; print "<br>"; print "<br>"; } function sub3() {print "sub 3"; print "<br>"; print "<br>"; } function avg() {print "Average Grade"; print "<br>"; print "<br>"; } function average($sub1,$sub2,$sub3) { $avg = ($sub1 + $sub2 + $sub3)/3; return $avg; } function lettergrade($avg) { if ($avg >= 80 && $avg<=100) $lettergrade = "A"; if ($avg >=65 && $avg <= 79) $lettergrade = "B"; if ($avg >= 50 && $avg <= 64) $lettergrade = "C"; if ($avg >= 40 && $avg <= 49) $lettergrade = "D"; if ($avg >= 0 && $avg <= 39) $lettergrade = "E"; return $lettergrade; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  (null)
number of ops:  45
compiled vars:  !0 = $fname, !1 = $lname, !2 = $test1, !3 = $test2, !4 = $test3, !5 = $avg, !6 = $sub1, !7 = $sub2, !8 = $sub3, !9 = $lg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3C%21DOCTYPE+html%3E%0A%3Chtml%3E%0A%3Chead%3E%0A%3Ctitle%3E+Average%3C%2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A'
    8     1        FETCH_R                      global              ~10     '_GET'
          2        FETCH_DIM_R                                      ~11     ~10, 'fname'
          3        ASSIGN                                                   !0, ~11
    9     4        FETCH_R                      global              ~13     '_GET'
          5        FETCH_DIM_R                                      ~14     ~13, 'lname'
          6        ASSIGN                                                   !1, ~14
   10     7        FETCH_R                      global              ~16     '_GET'
          8        FETCH_DIM_R                                      ~17     ~16, 'sub1'
          9        ASSIGN                                                   !2, ~17
   11    10        FETCH_R                      global              ~19     '_GET'
         11        FETCH_DIM_R                                      ~20     ~19, 'sub2'
         12        ASSIGN                                                   !3, ~20
   12    13        FETCH_R                      global              ~22     '_GET'
         14        FETCH_DIM_R                                      ~23     ~22, 'sub3'
         15        ASSIGN                                                   !4, ~23
   15    16        INIT_FCALL_BY_NAME                                       'average'
         17        SEND_VAR_EX                                              !6
         18        SEND_VAR_EX                                              !7
         19        SEND_VAR_EX                                              !8
         20        DO_FCALL                                      0  $25     
         21        ASSIGN                                                   !5, $25
   16    22        INIT_FCALL_BY_NAME                                       'lettergrade'
         23        SEND_VAR_EX                                              !5
         24        DO_FCALL                                      0  $27     
         25        ASSIGN                                                   !9, $27
   17    26        INIT_FCALL_BY_NAME                                       'fname'
         27        DO_FCALL                                      0          
   18    28        INIT_FCALL_BY_NAME                                       'lname'
         29        DO_FCALL                                      0          
   19    30        INIT_FCALL_BY_NAME                                       'sub1'
         31        SEND_VAR_EX                                              !5
         32        DO_FCALL                                      0  $31     
         33        ASSIGN                                                   !6, $31
   20    34        INIT_FCALL_BY_NAME                                       'sub2'
         35        SEND_VAR_EX                                              !5
         36        DO_FCALL                                      0  $33     
         37        ASSIGN                                                   !7, $33
   21    38        INIT_FCALL_BY_NAME                                       'sub3'
         39        SEND_VAR_EX                                              !5
         40        DO_FCALL                                      0  $35     
         41        ASSIGN                                                   !8, $35
   22    42        INIT_FCALL_BY_NAME                                       'avg'
         43        DO_FCALL                                      0          
  144    44      > RETURN                                                   1

Function fname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  fname
number of ops:  5
compiled vars:  !0 = $fname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ECHO                                                     'First+Name%3A'
   26     1        ECHO                                                     !0
   28     2        ECHO                                                     '%3Cbr%3E'
   30     3        ECHO                                                     '%3Cbr%3E'
   32     4      > RETURN                                                   null

End of function fname

Function lname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  lname
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   ECHO                                                     'Last+Name%3A'
   40     1        ECHO                                                     '%3Cbr%3E'
   42     2        ECHO                                                     '%3Cbr%3E'
   44     3      > RETURN                                                   null

End of function lname

Function sub1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  sub1
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   ECHO                                                     'sub+1'
   52     1        ECHO                                                     '%3Cbr%3E'
   54     2        ECHO                                                     '%3Cbr%3E'
   56     3      > RETURN                                                   null

End of function sub1

Function sub2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  sub2
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   ECHO                                                     'sub+2'
   62     1        ECHO                                                     '%3Cbr%3E'
   64     2        ECHO                                                     '%3Cbr%3E'
   66     3      > RETURN                                                   null

End of function sub2

Function sub3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  sub3
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   72     0  E >   ECHO                                                     'sub+3'
   74     1        ECHO                                                     '%3Cbr%3E'
   76     2        ECHO                                                     '%3Cbr%3E'
   78     3      > RETURN                                                   null

End of function sub3

Function avg:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  avg
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   84     0  E >   ECHO                                                     'Average+Grade'
   86     1        ECHO                                                     '%3Cbr%3E'
   88     2        ECHO                                                     '%3Cbr%3E'
   90     3      > RETURN                                                   null

End of function avg

Function average:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcBRW
function name:  average
number of ops:  9
compiled vars:  !0 = $sub1, !1 = $sub2, !2 = $sub3, !3 = $avg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   98     3        ADD                                              ~4      !0, !1
          4        ADD                                              ~5      ~4, !2
          5        DIV                                              ~6      ~5, 3
          6        ASSIGN                                                   !3, ~6
  100     7      > RETURN                                                   !3
  102     8*     > RETURN                                                   null

End of function average

Function lettergrade:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 29
Branch analysis from position: 25
Branch analysis from position: 23
Branch analysis from position: 19
Branch analysis from position: 17
Branch analysis from position: 13
Branch analysis from position: 11
Branch analysis from position: 7
Branch analysis from position: 5
filename:       /in/HcBRW
function name:  lettergrade
number of ops:  33
compiled vars:  !0 = $avg, !1 = $lettergrade
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  106     0  E >   RECV                                             !0      
  110     1        IS_SMALLER_OR_EQUAL                              ~2      80, !0
          2      > JMPZ_EX                                          ~2      ~2, ->5
          3    >   IS_SMALLER_OR_EQUAL                              ~3      !0, 100
          4        BOOL                                             ~2      ~3
          5    > > JMPZ                                                     ~2, ->7
  112     6    >   ASSIGN                                                   !1, 'A'
  116     7    >   IS_SMALLER_OR_EQUAL                              ~5      65, !0
          8      > JMPZ_EX                                          ~5      ~5, ->11
          9    >   IS_SMALLER_OR_EQUAL                              ~6      !0, 79
         10        BOOL                                             ~5      ~6
         11    > > JMPZ                                                     ~5, ->13
  118    12    >   ASSIGN                                                   !1, 'B'
  122    13    >   IS_SMALLER_OR_EQUAL                              ~8      50, !0
         14      > JMPZ_EX                                          ~8      ~8, ->17
         15    >   IS_SMALLER_OR_EQUAL                              ~9      !0, 64
         16        BOOL                                             ~8      ~9
         17    > > JMPZ                                                     ~8, ->19
  124    18    >   ASSIGN                                                   !1, 'C'
  128    19    >   IS_SMALLER_OR_EQUAL                              ~11     40, !0
         20      > JMPZ_EX                                          ~11     ~11, ->23
         21    >   IS_SMALLER_OR_EQUAL                              ~12     !0, 49
         22        BOOL                                             ~11     ~12
         23    > > JMPZ                                                     ~11, ->25
  130    24    >   ASSIGN                                                   !1, 'D'
  134    25    >   IS_SMALLER_OR_EQUAL                              ~14     0, !0
         26      > JMPZ_EX                                          ~14     ~14, ->29
         27    >   IS_SMALLER_OR_EQUAL                              ~15     !0, 39
         28        BOOL                                             ~14     ~15
         29    > > JMPZ                                                     ~14, ->31
  136    30    >   ASSIGN                                                   !1, 'E'
  142    31    > > RETURN                                                   !1
  144    32*     > RETURN                                                   null

End of function lettergrade

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.15 ms | 1407 KiB | 13 Q