3v4l.org

run code in 300+ PHP versions simultaneously
<?php function updateGoals() { $response = array(); if(!empty($_POST)){ if(isset($_POST["actID"]) && isset($_POST["nutID"]) && isset($_POST["activityProgress"]) && isset($_POST["nutritionProgress"])){ $actID = intval($_POST["actID"]); $nutID = intval($_POST["nutID"]); $actProg = floatval($_POST["activityProgress"]); $nutProg = floatval($_POST["nutritionProgress"]); } $query = "UPDATE Goals SET Progress='$nutProg' WHERE GoalID=$nutID;"; $result = mysql_query($query) or die(mysql_error()); if ($result) { $response["error"] = false; $response["message"] = "Nutrtition goal updated successfully!"; } else { $response["error"] = true; $response["message"] = "Failed to update nutrtition goal!"; } $query = "UPDATE Goals SET Progress='$actProg' WHERE GoalID=$actID;"; $result = mysql_query($query) or die(mysql_error()); if ($result) { $response["error"] = false; $response["message"] = "Activity goal updated successfully!"; } else { $response["error"] = true; $response["message"] = "Failed to update activity goal!"; } if (isset($_POST["newgoalID"]) && isset($_POST["newgoal"]) && $isset($_POST["newgoalProgress"])) { $newGoalID = intval($_POST["newgoalID"]); $newgoal = $_POST["newgoal"]; $newGoalProg = floatval($_POST["newgoalProgress"]); $query = "UPDATE Goals SET Description='$newgoal',Progress='$newGoalProg' WHERE GoalID=$newGoalID;"; $result = mysql_query($query) or die(mysql_error()); } else if(isset($_POST["newgoal"]) && isset($_POST["pid"]) && isset($_POST["week"])) { $newgoal = $_POST["newgoal"]; $pid = intval($_POST["pid"]); $week = intval($_POST["week"]); $query = "INSERT INTO Goals (ParticipantID, Type, Description, WeekNumbe r) VALUES ('$pid', 'OTHER', '$newgoal', '$week');"; $result = mysql_query($query) or die(mysql_error()); } } else { $response["error"] = true; $response["message"] = "Things are missing!"; } } updateGoals(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Lne6
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   INIT_FCALL                                               'updategoals'
          1        DO_FCALL                                      0          
   53     2      > RETURN                                                   1

Function updategoals:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 169
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 35
Branch analysis from position: 19
2 jumps found. (Code = 47) Position 1 = 46, Position 2 = 50
Branch analysis from position: 46
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 56
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 47) Position 1 = 71, Position 2 = 75
Branch analysis from position: 71
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 81
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
2 jumps found. (Code = 46) Position 1 = 88, Position 2 = 91
Branch analysis from position: 88
2 jumps found. (Code = 46) Position 1 = 92, Position 2 = 99
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 129
Branch analysis from position: 100
2 jumps found. (Code = 47) Position 1 = 124, Position 2 = 128
Branch analysis from position: 124
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 128
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
1 jumps found. (Code = 42) Position 1 = 173
Branch analysis from position: 173
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 129
2 jumps found. (Code = 46) Position 1 = 132, Position 2 = 135
Branch analysis from position: 132
2 jumps found. (Code = 46) Position 1 = 136, Position 2 = 139
Branch analysis from position: 136
2 jumps found. (Code = 43) Position 1 = 140, Position 2 = 168
Branch analysis from position: 140
2 jumps found. (Code = 47) Position 1 = 164, Position 2 = 168
Branch analysis from position: 164
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 168
Branch analysis from position: 168
Branch analysis from position: 139
Branch analysis from position: 135
Branch analysis from position: 99
Branch analysis from position: 91
Branch analysis from position: 81
2 jumps found. (Code = 46) Position 1 = 88, Position 2 = 91
Branch analysis from position: 88
Branch analysis from position: 91
Branch analysis from position: 56
2 jumps found. (Code = 47) Position 1 = 71, Position 2 = 75
Branch analysis from position: 71
Branch analysis from position: 75
Branch analysis from position: 35
Branch analysis from position: 18
Branch analysis from position: 14
Branch analysis from position: 10
Branch analysis from position: 169
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Lne6
function name:  updateGoals
number of ops:  174
compiled vars:  !0 = $response, !1 = $actID, !2 = $nutID, !3 = $actProg, !4 = $nutProg, !5 = $query, !6 = $result, !7 = $isset, !8 = $newGoalID, !9 = $newgoal, !10 = $newGoalProg, !11 = $pid, !12 = $week
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ISSET_ISEMPTY_VAR                             3  ~14     '_POST'
          2        BOOL_NOT                                         ~15     ~14
          3      > JMPZ                                                     ~15, ->169
    5     4    >   FETCH_IS                                         ~16     '_POST'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~17     ~16, 'actID'
          6      > JMPZ_EX                                          ~17     ~17, ->10
          7    >   FETCH_IS                                         ~18     '_POST'
          8        ISSET_ISEMPTY_DIM_OBJ                         0  ~19     ~18, 'nutID'
          9        BOOL                                             ~17     ~19
         10    > > JMPZ_EX                                          ~17     ~17, ->14
    6    11    >   FETCH_IS                                         ~20     '_POST'
         12        ISSET_ISEMPTY_DIM_OBJ                         0  ~21     ~20, 'activityProgress'
         13        BOOL                                             ~17     ~21
         14    > > JMPZ_EX                                          ~17     ~17, ->18
         15    >   FETCH_IS                                         ~22     '_POST'
         16        ISSET_ISEMPTY_DIM_OBJ                         0  ~23     ~22, 'nutritionProgress'
         17        BOOL                                             ~17     ~23
         18    > > JMPZ                                                     ~17, ->35
    7    19    >   FETCH_R                      global              ~24     '_POST'
         20        FETCH_DIM_R                                      ~25     ~24, 'actID'
         21        CAST                                          4  ~26     ~25
         22        ASSIGN                                                   !1, ~26
    8    23        FETCH_R                      global              ~28     '_POST'
         24        FETCH_DIM_R                                      ~29     ~28, 'nutID'
         25        CAST                                          4  ~30     ~29
         26        ASSIGN                                                   !2, ~30
    9    27        FETCH_R                      global              ~32     '_POST'
         28        FETCH_DIM_R                                      ~33     ~32, 'activityProgress'
         29        CAST                                          5  ~34     ~33
         30        ASSIGN                                                   !3, ~34
   10    31        FETCH_R                      global              ~36     '_POST'
         32        FETCH_DIM_R                                      ~37     ~36, 'nutritionProgress'
         33        CAST                                          5  ~38     ~37
         34        ASSIGN                                                   !4, ~38
   12    35    >   ROPE_INIT                                     5  ~41     'UPDATE+Goals+SET+Progress%3D%27'
         36        ROPE_ADD                                      1  ~41     ~41, !4
         37        ROPE_ADD                                      2  ~41     ~41, '%27+WHERE+GoalID%3D'
         38        ROPE_ADD                                      3  ~41     ~41, !2
         39        ROPE_END                                      4  ~40     ~41, '%3B'
         40        ASSIGN                                                   !5, ~40
   13    41        INIT_FCALL_BY_NAME                                       'mysql_query'
         42        SEND_VAR_EX                                              !5
         43        DO_FCALL                                      0  $45     
         44        ASSIGN                                           ~46     !6, $45
         45      > JMPNZ_EX                                         ~46     ~46, ->50
         46    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         47        DO_FCALL                                      0  $47     
         48      > EXIT                                                     $47
         49*       BOOL                                             ~46     <true>
   14    50    > > JMPZ                                                     !6, ->56
   15    51    >   ASSIGN_DIM                                               !0, 'error'
         52        OP_DATA                                                  <false>
   16    53        ASSIGN_DIM                                               !0, 'message'
         54        OP_DATA                                                  'Nutrtition+goal+updated+successfully%21'
         55      > JMP                                                      ->60
   18    56    >   ASSIGN_DIM                                               !0, 'error'
         57        OP_DATA                                                  <true>
   19    58        ASSIGN_DIM                                               !0, 'message'
         59        OP_DATA                                                  'Failed+to+update+nutrtition+goal%21'
   21    60    >   ROPE_INIT                                     5  ~53     'UPDATE+Goals+SET+Progress%3D%27'
         61        ROPE_ADD                                      1  ~53     ~53, !3
         62        ROPE_ADD                                      2  ~53     ~53, '%27+WHERE+GoalID%3D'
         63        ROPE_ADD                                      3  ~53     ~53, !1
         64        ROPE_END                                      4  ~52     ~53, '%3B'
         65        ASSIGN                                                   !5, ~52
   22    66        INIT_FCALL_BY_NAME                                       'mysql_query'
         67        SEND_VAR_EX                                              !5
         68        DO_FCALL                                      0  $57     
         69        ASSIGN                                           ~58     !6, $57
         70      > JMPNZ_EX                                         ~58     ~58, ->75
         71    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         72        DO_FCALL                                      0  $59     
         73      > EXIT                                                     $59
         74*       BOOL                                             ~58     <true>
   23    75    > > JMPZ                                                     !6, ->81
   24    76    >   ASSIGN_DIM                                               !0, 'error'
         77        OP_DATA                                                  <false>
   25    78        ASSIGN_DIM                                               !0, 'message'
         79        OP_DATA                                                  'Activity+goal+updated+successfully%21'
         80      > JMP                                                      ->85
   27    81    >   ASSIGN_DIM                                               !0, 'error'
         82        OP_DATA                                                  <true>
   28    83        ASSIGN_DIM                                               !0, 'message'
         84        OP_DATA                                                  'Failed+to+update+activity+goal%21'
   30    85    >   FETCH_IS                                         ~64     '_POST'
         86        ISSET_ISEMPTY_DIM_OBJ                         0  ~65     ~64, 'newgoalID'
         87      > JMPZ_EX                                          ~65     ~65, ->91
         88    >   FETCH_IS                                         ~66     '_POST'
         89        ISSET_ISEMPTY_DIM_OBJ                         0  ~67     ~66, 'newgoal'
         90        BOOL                                             ~65     ~67
         91    > > JMPZ_EX                                          ~65     ~65, ->99
   31    92    >   INIT_DYNAMIC_CALL                                        !7
         93        CHECK_FUNC_ARG                                           
         94        FETCH_FUNC_ARG               global              $68     '_POST'
         95        FETCH_DIM_FUNC_ARG                               $69     $68, 'newgoalProgress'
         96        SEND_FUNC_ARG                                            $69
         97        DO_FCALL                                      0  $70     
         98        BOOL                                             ~65     $70
         99    > > JMPZ                                                     ~65, ->129
   32   100    >   FETCH_R                      global              ~71     '_POST'
        101        FETCH_DIM_R                                      ~72     ~71, 'newgoalID'
        102        CAST                                          4  ~73     ~72
        103        ASSIGN                                                   !8, ~73
   33   104        FETCH_R                      global              ~75     '_POST'
        105        FETCH_DIM_R                                      ~76     ~75, 'newgoal'
        106        ASSIGN                                                   !9, ~76
   34   107        FETCH_R                      global              ~78     '_POST'
        108        FETCH_DIM_R                                      ~79     ~78, 'newgoalProgress'
        109        CAST                                          5  ~80     ~79
        110        ASSIGN                                                   !10, ~80
   35   111        ROPE_INIT                                     7  ~83     'UPDATE+Goals+SET+Description%3D%27'
        112        ROPE_ADD                                      1  ~83     ~83, !9
        113        ROPE_ADD                                      2  ~83     ~83, '%27%2CProgress%3D%27'
        114        ROPE_ADD                                      3  ~83     ~83, !10
        115        ROPE_ADD                                      4  ~83     ~83, '%27+WHERE+GoalID%3D'
        116        ROPE_ADD                                      5  ~83     ~83, !8
        117        ROPE_END                                      6  ~82     ~83, '%3B'
        118        ASSIGN                                                   !5, ~82
   36   119        INIT_FCALL_BY_NAME                                       'mysql_query'
        120        SEND_VAR_EX                                              !5
        121        DO_FCALL                                      0  $88     
        122        ASSIGN                                           ~89     !6, $88
        123      > JMPNZ_EX                                         ~89     ~89, ->128
        124    >   INIT_FCALL_BY_NAME                                       'mysql_error'
        125        DO_FCALL                                      0  $90     
        126      > EXIT                                                     $90
        127*       BOOL                                             ~89     <true>
        128    > > JMP                                                      ->168
   38   129    >   FETCH_IS                                         ~91     '_POST'
        130        ISSET_ISEMPTY_DIM_OBJ                         0  ~92     ~91, 'newgoal'
        131      > JMPZ_EX                                          ~92     ~92, ->135
        132    >   FETCH_IS                                         ~93     '_POST'
        133        ISSET_ISEMPTY_DIM_OBJ                         0  ~94     ~93, 'pid'
        134        BOOL                                             ~92     ~94
        135    > > JMPZ_EX                                          ~92     ~92, ->139
   39   136    >   FETCH_IS                                         ~95     '_POST'
        137        ISSET_ISEMPTY_DIM_OBJ                         0  ~96     ~95, 'week'
        138        BOOL                                             ~92     ~96
        139    > > JMPZ                                                     ~92, ->168
   40   140    >   FETCH_R                      global              ~97     '_POST'
        141        FETCH_DIM_R                                      ~98     ~97, 'newgoal'
        142        ASSIGN                                                   !9, ~98
   41   143        FETCH_R                      global              ~100    '_POST'
        144        FETCH_DIM_R                                      ~101    ~100, 'pid'
        145        CAST                                          4  ~102    ~101
        146        ASSIGN                                                   !11, ~102
   42   147        FETCH_R                      global              ~104    '_POST'
        148        FETCH_DIM_R                                      ~105    ~104, 'week'
        149        CAST                                          4  ~106    ~105
        150        ASSIGN                                                   !12, ~106
   43   151        ROPE_INIT                                     7  ~109    'INSERT+INTO+Goals+%28ParticipantID%2C+Type%2C+Description%2C+WeekNumbe%0Ar%29+VALUES+%28%27'
   44   152        ROPE_ADD                                      1  ~109    ~109, !11
        153        ROPE_ADD                                      2  ~109    ~109, '%27%2C+%27OTHER%27%2C+%27'
        154        ROPE_ADD                                      3  ~109    ~109, !9
        155        ROPE_ADD                                      4  ~109    ~109, '%27%2C+%27'
        156        ROPE_ADD                                      5  ~109    ~109, !12
        157        ROPE_END                                      6  ~108    ~109, '%27%29%3B'
   43   158        ASSIGN                                                   !5, ~108
   45   159        INIT_FCALL_BY_NAME                                       'mysql_query'
        160        SEND_VAR_EX                                              !5
        161        DO_FCALL                                      0  $114    
        162        ASSIGN                                           ~115    !6, $114
        163      > JMPNZ_EX                                         ~115    ~115, ->168
        164    >   INIT_FCALL_BY_NAME                                       'mysql_error'
        165        DO_FCALL                                      0  $116    
        166      > EXIT                                                     $116
        167*       BOOL                                             ~115    <true>
        168    > > JMP                                                      ->173
   48   169    >   ASSIGN_DIM                                               !0, 'error'
        170        OP_DATA                                                  <true>
   49   171        ASSIGN_DIM                                               !0, 'message'
        172        OP_DATA                                                  'Things+are+missing%21'
   51   173    > > RETURN                                                   null

End of function updategoals

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.92 ms | 1415 KiB | 14 Q