3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createNewGoals() { $response = array(); if (isset($_POST["activity"]) && isset($_POST["pid"]) && isset($_POST["activityProgress"]) && isset($_POST["nutritionProgress"]) && isset($_POST["nutrition"]) && isset($_POST["week"])) { $activity = $_POST["activity"]; $activityProg = floatval($_POST["activityProgress"]); $pid = intval($_POST["pid"]); $nutrition = $_POST["nutrition"]; $nutritionProg = floatval($_POST["nutritionProgress"]); $week = intval($_POST["week"]); $query = "INSERT INTO Goals (ParticipantID, Type, Description, WeekNumber, Progress) VALUES ('$pid', 'EXERCISE', '$activity', '$week', '$activityProg');"; $result = mysql_query($query) or die(mysql_error()); if ($result) { $response["error"] = false; $response["message"] = "Activity goal created successfully!"; } else { $response["error"] = true; $response["message"] = "Failed to create activity goal!"; } $query = "INSERT INTO Goals (ParticipantID, Type, Description, WeekNumber, Progress) VALUES ('$pid', 'NUTRITION', '$nutrition', '$week', $nutritionProg');"; $result = mysql_query($query) or die(mysql_error()); if ($result) { $response["error"] = false; $response["message"] = "Nutrtition goal created successfully!"; } else { $response["error"] = true; $response["message"] = "Failed to create nutrtition goal!"; } } else { $response["error"] = true; $response["message"] = "Things are missing!"; } // echo json response echo json_encode($response); } createNewGoals(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3oKkc
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   INIT_FCALL                                               'createnewgoals'
          1        DO_FCALL                                      0          
   41     2      > RETURN                                                   1

Function createnewgoals:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 105
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 61, Position 2 = 65
Branch analysis from position: 61
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 71
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 47) Position 1 = 90, Position 2 = 94
Branch analysis from position: 90
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 94
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 100
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
Branch analysis from position: 71
2 jumps found. (Code = 47) Position 1 = 90, Position 2 = 94
Branch analysis from position: 90
Branch analysis from position: 94
Branch analysis from position: 105
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 19
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 7
filename:       /in/3oKkc
function name:  createNewGoals
number of ops:  114
compiled vars:  !0 = $response, !1 = $activity, !2 = $activityProg, !3 = $pid, !4 = $nutrition, !5 = $nutritionProg, !6 = $week, !7 = $query, !8 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        FETCH_IS                                         ~10     '_POST'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     ~10, 'activity'
          3      > JMPZ_EX                                          ~11     ~11, ->7
          4    >   FETCH_IS                                         ~12     '_POST'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~13     ~12, 'pid'
          6        BOOL                                             ~11     ~13
          7    > > JMPZ_EX                                          ~11     ~11, ->11
    5     8    >   FETCH_IS                                         ~14     '_POST'
          9        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     ~14, 'activityProgress'
         10        BOOL                                             ~11     ~15
         11    > > JMPZ_EX                                          ~11     ~11, ->15
    6    12    >   FETCH_IS                                         ~16     '_POST'
         13        ISSET_ISEMPTY_DIM_OBJ                         0  ~17     ~16, 'nutritionProgress'
         14        BOOL                                             ~11     ~17
         15    > > JMPZ_EX                                          ~11     ~11, ->19
    7    16    >   FETCH_IS                                         ~18     '_POST'
         17        ISSET_ISEMPTY_DIM_OBJ                         0  ~19     ~18, 'nutrition'
         18        BOOL                                             ~11     ~19
         19    > > JMPZ_EX                                          ~11     ~11, ->23
         20    >   FETCH_IS                                         ~20     '_POST'
         21        ISSET_ISEMPTY_DIM_OBJ                         0  ~21     ~20, 'week'
         22        BOOL                                             ~11     ~21
         23    > > JMPZ                                                     ~11, ->105
    9    24    >   FETCH_R                      global              ~22     '_POST'
         25        FETCH_DIM_R                                      ~23     ~22, 'activity'
         26        ASSIGN                                                   !1, ~23
   10    27        FETCH_R                      global              ~25     '_POST'
         28        FETCH_DIM_R                                      ~26     ~25, 'activityProgress'
         29        CAST                                          5  ~27     ~26
         30        ASSIGN                                                   !2, ~27
   11    31        FETCH_R                      global              ~29     '_POST'
         32        FETCH_DIM_R                                      ~30     ~29, 'pid'
         33        CAST                                          4  ~31     ~30
         34        ASSIGN                                                   !3, ~31
   12    35        FETCH_R                      global              ~33     '_POST'
         36        FETCH_DIM_R                                      ~34     ~33, 'nutrition'
         37        ASSIGN                                                   !4, ~34
   13    38        FETCH_R                      global              ~36     '_POST'
         39        FETCH_DIM_R                                      ~37     ~36, 'nutritionProgress'
         40        CAST                                          5  ~38     ~37
         41        ASSIGN                                                   !5, ~38
   14    42        FETCH_R                      global              ~40     '_POST'
         43        FETCH_DIM_R                                      ~41     ~40, 'week'
         44        CAST                                          4  ~42     ~41
         45        ASSIGN                                                   !6, ~42
   15    46        ROPE_INIT                                     9  ~45     'INSERT+INTO+Goals+%28ParticipantID%2C+Type%2C+Description%2C+WeekNumber%2C+Progress%29+VALUES+%28%27'
         47        ROPE_ADD                                      1  ~45     ~45, !3
         48        ROPE_ADD                                      2  ~45     ~45, '%27%2C+%27EXERCISE%27%2C+%27'
         49        ROPE_ADD                                      3  ~45     ~45, !1
         50        ROPE_ADD                                      4  ~45     ~45, '%27%2C+%27'
         51        ROPE_ADD                                      5  ~45     ~45, !6
         52        ROPE_ADD                                      6  ~45     ~45, '%27%2C+%27'
         53        ROPE_ADD                                      7  ~45     ~45, !2
         54        ROPE_END                                      8  ~44     ~45, '%27%29%3B'
         55        ASSIGN                                                   !7, ~44
   16    56        INIT_FCALL_BY_NAME                                       'mysql_query'
         57        SEND_VAR_EX                                              !7
         58        DO_FCALL                                      0  $51     
         59        ASSIGN                                           ~52     !8, $51
         60      > JMPNZ_EX                                         ~52     ~52, ->65
         61    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         62        DO_FCALL                                      0  $53     
         63      > EXIT                                                     $53
         64*       BOOL                                             ~52     <true>
   17    65    > > JMPZ                                                     !8, ->71
   18    66    >   ASSIGN_DIM                                               !0, 'error'
         67        OP_DATA                                                  <false>
   19    68        ASSIGN_DIM                                               !0, 'message'
         69        OP_DATA                                                  'Activity+goal+created+successfully%21'
         70      > JMP                                                      ->75
   21    71    >   ASSIGN_DIM                                               !0, 'error'
         72        OP_DATA                                                  <true>
   22    73        ASSIGN_DIM                                               !0, 'message'
         74        OP_DATA                                                  'Failed+to+create+activity+goal%21'
   24    75    >   ROPE_INIT                                     9  ~59     'INSERT+INTO+Goals+%28ParticipantID%2C+Type%2C+Description%2C+WeekNumber%2C+Progress%29+VALUES+%28%27'
         76        ROPE_ADD                                      1  ~59     ~59, !3
         77        ROPE_ADD                                      2  ~59     ~59, '%27%2C+%27NUTRITION%27%2C+%27'
         78        ROPE_ADD                                      3  ~59     ~59, !4
         79        ROPE_ADD                                      4  ~59     ~59, '%27%2C+%27'
         80        ROPE_ADD                                      5  ~59     ~59, !6
         81        ROPE_ADD                                      6  ~59     ~59, '%27%2C+'
         82        ROPE_ADD                                      7  ~59     ~59, !5
         83        ROPE_END                                      8  ~58     ~59, '%27%29%3B'
         84        ASSIGN                                                   !7, ~58
   25    85        INIT_FCALL_BY_NAME                                       'mysql_query'
         86        SEND_VAR_EX                                              !7
         87        DO_FCALL                                      0  $65     
         88        ASSIGN                                           ~66     !8, $65
         89      > JMPNZ_EX                                         ~66     ~66, ->94
         90    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         91        DO_FCALL                                      0  $67     
         92      > EXIT                                                     $67
         93*       BOOL                                             ~66     <true>
   26    94    > > JMPZ                                                     !8, ->100
   27    95    >   ASSIGN_DIM                                               !0, 'error'
         96        OP_DATA                                                  <false>
   28    97        ASSIGN_DIM                                               !0, 'message'
         98        OP_DATA                                                  'Nutrtition+goal+created+successfully%21'
         99      > JMP                                                      ->104
   30   100    >   ASSIGN_DIM                                               !0, 'error'
        101        OP_DATA                                                  <true>
   31   102        ASSIGN_DIM                                               !0, 'message'
        103        OP_DATA                                                  'Failed+to+create+nutrtition+goal%21'
        104    > > JMP                                                      ->109
   34   105    >   ASSIGN_DIM                                               !0, 'error'
        106        OP_DATA                                                  <true>
   35   107        ASSIGN_DIM                                               !0, 'message'
        108        OP_DATA                                                  'Things+are+missing%21'
   38   109    >   INIT_FCALL                                               'json_encode'
        110        SEND_VAR                                                 !0
        111        DO_ICALL                                         $74     
        112        ECHO                                                     $74
   39   113      > RETURN                                                   null

End of function createnewgoals

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.46 ms | 1411 KiB | 16 Q