3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user = Auth::user(); $now = new DateTime(); $then = Session::get('user_last_login'); if (Session::has('notifications.last_retrieve')) { $then = Session::get('notifications.last_retrieve'); } //Adjusting the time for the notification to work. $then->modify('+1 second'); //Publications from sent friendship user $published_books1 = DB::table('published_books as a') ->join('user_relationships as b', 'a.user_id', '=', 'b.user_id') #->join('books as d', 'a.book_id', '=', 'd.id') ->join('users as e', 'a.user_id', '=', 'e.id') ->join('people as f', 'e.id', '=', 'f.user_id') ->where('b.request_status', $acknowledged_id) ->where(function ($query) use ($user) { $query->where('b.requester_id', $user->id); }) ->whereBetween('a.creted_at', [$then, $now]) ->where('e.username', '<>', Auth::user()->username) ->groupBy('a.id', 'e.id') ->select(DB::raw("concat(f.firstname, ' ', f.lastname) as name"), 'e.username', 'a.published_book_title as title', 'a.id'); //Synchronizing to the former time $then->modify('-1 second'); if ($published_books1->count() > 0) { $notifications['published_books1'] = $published_books1->get(); /*Mail::send('emails.registro', array('key' => 'value'), function($message) { $message->subject('Bienvenido a la gran experiencia.'); $message->from(env('CONTACT_MAIL'), env('CONTACT_NAME')); $message->to(Auth::user()->email); }); */ } //Adjusting the time for the notification to work. $then->modify('+1 second'); //Publications from received friendship users $published_books2 = DB::table('published_books as a') ->join('user_relationships as c', 'a.user_id', '=', 'c.requester_id') #->join('books as d', 'a.book_id', '=', 'd.id') ->join('users as e', 'a.user_id', '=', 'e.id') ->join('people as f', 'e.id', '=', 'f.user_id') ->where('c.request_status', $acknowledged_id) ->where('c.request_status', $acknowledged_id) ->where(function ($query) use ($user) { $query->where('c.requester_id', $user->id) ->orWhere('c.user_id', $user->id); }) ->whereBetween('a.creted_at', [$then, $now]) ->where('e.username', '<>', Auth::user()->username) ->groupBy('a.id', 'e.id') ->select(DB::raw("concat(f.firstname, ' ', f.lastname) as name"), 'e.username', 'a.published_book_title as title', 'a.id'); //Synchronizing to the former time $then->modify('-1 second'); if ($published_books2->count() > 0) { $notifications['published_books2'] = $published_books2->get(); /*Mail::send('emails.registro', array('key' => 'value'), function($message) { $message->subject('Bienvenido a la gran experiencia.'); $message->from(env('CONTACT_MAIL'), env('CONTACT_NAME')); $message->to(Auth::user()->email); }); */ }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 91
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 164, Position 2 = 168
Branch analysis from position: 164
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 168
Branch analysis from position: 91
Branch analysis from position: 18
filename:       /in/qcHsa
function name:  (null)
number of ops:  169
compiled vars:  !0 = $user, !1 = $now, !2 = $then, !3 = $published_books1, !4 = $acknowledged_id, !5 = $notifications, !6 = $published_books2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_STATIC_METHOD_CALL                                  'Auth', 'user'
          1        DO_FCALL                                      0  $7      
          2        ASSIGN                                                   !0, $7
    4     3        NEW                                              $9      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $9
    5     6        INIT_STATIC_METHOD_CALL                                  'Session', 'get'
          7        SEND_VAL_EX                                              'user_last_login'
          8        DO_FCALL                                      0  $12     
          9        ASSIGN                                                   !2, $12
    6    10        INIT_STATIC_METHOD_CALL                                  'Session', 'has'
         11        SEND_VAL_EX                                              'notifications.last_retrieve'
         12        DO_FCALL                                      0  $14     
         13      > JMPZ                                                     $14, ->18
    7    14    >   INIT_STATIC_METHOD_CALL                                  'Session', 'get'
         15        SEND_VAL_EX                                              'notifications.last_retrieve'
         16        DO_FCALL                                      0  $15     
         17        ASSIGN                                                   !2, $15
   12    18    >   INIT_METHOD_CALL                                         !2, 'modify'
         19        SEND_VAL_EX                                              '%2B1+second'
         20        DO_FCALL                                      0          
   15    21        INIT_STATIC_METHOD_CALL                                  'DB', 'table'
         22        SEND_VAL_EX                                              'published_books+as+a'
         23        DO_FCALL                                      0  $18     
   16    24        INIT_METHOD_CALL                                         $18, 'join'
         25        SEND_VAL_EX                                              'user_relationships+as+b'
         26        SEND_VAL_EX                                              'a.user_id'
         27        SEND_VAL_EX                                              '%3D'
         28        SEND_VAL_EX                                              'b.user_id'
         29        DO_FCALL                                      0  $19     
   18    30        INIT_METHOD_CALL                                         $19, 'join'
         31        SEND_VAL_EX                                              'users+as+e'
         32        SEND_VAL_EX                                              'a.user_id'
         33        SEND_VAL_EX                                              '%3D'
         34        SEND_VAL_EX                                              'e.id'
         35        DO_FCALL                                      0  $20     
   19    36        INIT_METHOD_CALL                                         $20, 'join'
         37        SEND_VAL_EX                                              'people+as+f'
         38        SEND_VAL_EX                                              'e.id'
         39        SEND_VAL_EX                                              '%3D'
         40        SEND_VAL_EX                                              'f.user_id'
         41        DO_FCALL                                      0  $21     
   20    42        INIT_METHOD_CALL                                         $21, 'where'
         43        SEND_VAL_EX                                              'b.request_status'
         44        SEND_VAR_EX                                              !4
         45        DO_FCALL                                      0  $22     
   21    46        INIT_METHOD_CALL                                         $22, 'where'
         47        DECLARE_LAMBDA_FUNCTION                          ~23     [0]
         48        BIND_LEXICAL                                             ~23, !0
   24    49        SEND_VAL_EX                                              ~23
   21    50        DO_FCALL                                      0  $24     
   25    51        INIT_METHOD_CALL                                         $24, 'whereBetween'
         52        SEND_VAL_EX                                              'a.creted_at'
         53        INIT_ARRAY                                       ~25     !2
         54        ADD_ARRAY_ELEMENT                                ~25     !1
         55        SEND_VAL_EX                                              ~25
         56        DO_FCALL                                      0  $26     
   26    57        INIT_METHOD_CALL                                         $26, 'where'
         58        SEND_VAL_EX                                              'e.username'
         59        SEND_VAL_EX                                              '%3C%3E'
         60        CHECK_FUNC_ARG                                           
         61        INIT_STATIC_METHOD_CALL                                  'Auth', 'user'
         62        DO_FCALL                                      0  $27     
         63        FETCH_OBJ_FUNC_ARG                               $28     $27, 'username'
         64        SEND_FUNC_ARG                                            $28
         65        DO_FCALL                                      0  $29     
   27    66        INIT_METHOD_CALL                                         $29, 'groupBy'
         67        SEND_VAL_EX                                              'a.id'
         68        SEND_VAL_EX                                              'e.id'
         69        DO_FCALL                                      0  $30     
   28    70        INIT_METHOD_CALL                                         $30, 'select'
         71        INIT_STATIC_METHOD_CALL                                  'DB', 'raw'
         72        SEND_VAL_EX                                              'concat%28f.firstname%2C+%27+%27%2C+f.lastname%29+as+name'
         73        DO_FCALL                                      0  $31     
         74        SEND_VAR_NO_REF_EX                                       $31
         75        SEND_VAL_EX                                              'e.username'
         76        SEND_VAL_EX                                              'a.published_book_title+as+title'
         77        SEND_VAL_EX                                              'a.id'
         78        DO_FCALL                                      0  $32     
   15    79        ASSIGN                                                   !3, $32
   31    80        INIT_METHOD_CALL                                         !2, 'modify'
         81        SEND_VAL_EX                                              '-1+second'
         82        DO_FCALL                                      0          
   33    83        INIT_METHOD_CALL                                         !3, 'count'
         84        DO_FCALL                                      0  $35     
         85        IS_SMALLER                                               0, $35
         86      > JMPZ                                                     ~36, ->91
   34    87    >   INIT_METHOD_CALL                                         !3, 'get'
         88        DO_FCALL                                      0  $38     
         89        ASSIGN_DIM                                               !5, 'published_books1'
         90        OP_DATA                                                  $38
   46    91    >   INIT_METHOD_CALL                                         !2, 'modify'
         92        SEND_VAL_EX                                              '%2B1+second'
         93        DO_FCALL                                      0          
   49    94        INIT_STATIC_METHOD_CALL                                  'DB', 'table'
         95        SEND_VAL_EX                                              'published_books+as+a'
         96        DO_FCALL                                      0  $40     
   50    97        INIT_METHOD_CALL                                         $40, 'join'
         98        SEND_VAL_EX                                              'user_relationships+as+c'
         99        SEND_VAL_EX                                              'a.user_id'
        100        SEND_VAL_EX                                              '%3D'
        101        SEND_VAL_EX                                              'c.requester_id'
        102        DO_FCALL                                      0  $41     
   52   103        INIT_METHOD_CALL                                         $41, 'join'
        104        SEND_VAL_EX                                              'users+as+e'
        105        SEND_VAL_EX                                              'a.user_id'
        106        SEND_VAL_EX                                              '%3D'
        107        SEND_VAL_EX                                              'e.id'
        108        DO_FCALL                                      0  $42     
   53   109        INIT_METHOD_CALL                                         $42, 'join'
        110        SEND_VAL_EX                                              'people+as+f'
        111        SEND_VAL_EX                                              'e.id'
        112        SEND_VAL_EX                                              '%3D'
        113        SEND_VAL_EX                                              'f.user_id'
        114        DO_FCALL                                      0  $43     
   54   115        INIT_METHOD_CALL                                         $43, 'where'
        116        SEND_VAL_EX                                              'c.request_status'
        117        SEND_VAR_EX                                              !4
        118        DO_FCALL                                      0  $44     
   55   119        INIT_METHOD_CALL                                         $44, 'where'
        120        SEND_VAL_EX                                              'c.request_status'
        121        SEND_VAR_EX                                              !4
        122        DO_FCALL                                      0  $45     
   56   123        INIT_METHOD_CALL                                         $45, 'where'
        124        DECLARE_LAMBDA_FUNCTION                          ~46     [1]
        125        BIND_LEXICAL                                             ~46, !0
   60   126        SEND_VAL_EX                                              ~46
   56   127        DO_FCALL                                      0  $47     
   61   128        INIT_METHOD_CALL                                         $47, 'whereBetween'
        129        SEND_VAL_EX                                              'a.creted_at'
        130        INIT_ARRAY                                       ~48     !2
        131        ADD_ARRAY_ELEMENT                                ~48     !1
        132        SEND_VAL_EX                                              ~48
        133        DO_FCALL                                      0  $49     
   62   134        INIT_METHOD_CALL                                         $49, 'where'
        135        SEND_VAL_EX                                              'e.username'
        136        SEND_VAL_EX                                              '%3C%3E'
        137        CHECK_FUNC_ARG                                           
        138        INIT_STATIC_METHOD_CALL                                  'Auth', 'user'
        139        DO_FCALL                                      0  $50     
        140        FETCH_OBJ_FUNC_ARG                               $51     $50, 'username'
        141        SEND_FUNC_ARG                                            $51
        142        DO_FCALL                                      0  $52     
   63   143        INIT_METHOD_CALL                                         $52, 'groupBy'
        144        SEND_VAL_EX                                              'a.id'
        145        SEND_VAL_EX                                              'e.id'
        146        DO_FCALL                                      0  $53     
   64   147        INIT_METHOD_CALL                                         $53, 'select'
        148        INIT_STATIC_METHOD_CALL                                  'DB', 'raw'
        149        SEND_VAL_EX                                              'concat%28f.firstname%2C+%27+%27%2C+f.lastname%29+as+name'
        150        DO_FCALL                                      0  $54     
        151        SEND_VAR_NO_REF_EX                                       $54
        152        SEND_VAL_EX                                              'e.username'
        153        SEND_VAL_EX                                              'a.published_book_title+as+title'
        154        SEND_VAL_EX                                              'a.id'
        155        DO_FCALL                                      0  $55     
   49   156        ASSIGN                                                   !6, $55
   67   157        INIT_METHOD_CALL                                         !2, 'modify'
        158        SEND_VAL_EX                                              '-1+second'
        159        DO_FCALL                                      0          
   69   160        INIT_METHOD_CALL                                         !6, 'count'
        161        DO_FCALL                                      0  $58     
        162        IS_SMALLER                                               0, $58
        163      > JMPZ                                                     ~59, ->168
   70   164    >   INIT_METHOD_CALL                                         !6, 'get'
        165        DO_FCALL                                      0  $61     
        166        ASSIGN_DIM                                               !5, 'published_books2'
        167        OP_DATA                                                  $61
   79   168    > > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qcHsa
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $query, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   23     2        INIT_METHOD_CALL                                         !0, 'where'
          3        SEND_VAL_EX                                              'b.requester_id'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_OBJ_FUNC_ARG                               $2      !1, 'id'
          6        SEND_FUNC_ARG                                            $2
          7        DO_FCALL                                      0          
   24     8      > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qcHsa
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $query, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   58     2        INIT_METHOD_CALL                                         !0, 'where'
          3        SEND_VAL_EX                                              'c.requester_id'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_OBJ_FUNC_ARG                               $2      !1, 'id'
          6        SEND_FUNC_ARG                                            $2
          7        DO_FCALL                                      0  $3      
   59     8        INIT_METHOD_CALL                                         $3, 'orWhere'
          9        SEND_VAL_EX                                              'c.user_id'
         10        CHECK_FUNC_ARG                                           
         11        FETCH_OBJ_FUNC_ARG                               $4      !1, 'id'
         12        SEND_FUNC_ARG                                            $4
         13        DO_FCALL                                      0          
   60    14      > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.83 ms | 1024 KiB | 13 Q