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'); 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); }); */ } //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 = 84, Position 2 = 88
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 158, Position 2 = 162
Branch analysis from position: 158
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 162
Branch analysis from position: 88
Branch analysis from position: 18
filename:       /in/dJaUY
function name:  (null)
number of ops:  163
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
   11    18    >   INIT_METHOD_CALL                                         !2, 'modify'
         19        SEND_VAL_EX                                              '%2B1+second'
         20        DO_FCALL                                      0          
   14    21        INIT_STATIC_METHOD_CALL                                  'DB', 'table'
         22        SEND_VAL_EX                                              'published_books+as+a'
         23        DO_FCALL                                      0  $18     
   15    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     
   17    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     
   18    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     
   19    42        INIT_METHOD_CALL                                         $21, 'where'
         43        SEND_VAL_EX                                              'b.request_status'
         44        SEND_VAR_EX                                              !4
         45        DO_FCALL                                      0  $22     
   20    46        INIT_METHOD_CALL                                         $22, 'where'
         47        DECLARE_LAMBDA_FUNCTION                          ~23     [0]
         48        BIND_LEXICAL                                             ~23, !0
   23    49        SEND_VAL_EX                                              ~23
   20    50        DO_FCALL                                      0  $24     
   24    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     
   25    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     
   26    66        INIT_METHOD_CALL                                         $29, 'groupBy'
         67        SEND_VAL_EX                                              'a.id'
         68        SEND_VAL_EX                                              'e.id'
         69        DO_FCALL                                      0  $30     
   27    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     
   14    79        ASSIGN                                                   !3, $32
   30    80        INIT_METHOD_CALL                                         !3, 'count'
         81        DO_FCALL                                      0  $34     
         82        IS_SMALLER                                               0, $34
         83      > JMPZ                                                     ~35, ->88
   31    84    >   INIT_METHOD_CALL                                         !3, 'get'
         85        DO_FCALL                                      0  $37     
         86        ASSIGN_DIM                                               !5, 'published_books1'
         87        OP_DATA                                                  $37
   44    88    >   INIT_STATIC_METHOD_CALL                                  'DB', 'table'
         89        SEND_VAL_EX                                              'published_books+as+a'
         90        DO_FCALL                                      0  $38     
   45    91        INIT_METHOD_CALL                                         $38, 'join'
         92        SEND_VAL_EX                                              'user_relationships+as+c'
         93        SEND_VAL_EX                                              'a.user_id'
         94        SEND_VAL_EX                                              '%3D'
         95        SEND_VAL_EX                                              'c.requester_id'
         96        DO_FCALL                                      0  $39     
   47    97        INIT_METHOD_CALL                                         $39, 'join'
         98        SEND_VAL_EX                                              'users+as+e'
         99        SEND_VAL_EX                                              'a.user_id'
        100        SEND_VAL_EX                                              '%3D'
        101        SEND_VAL_EX                                              'e.id'
        102        DO_FCALL                                      0  $40     
   48   103        INIT_METHOD_CALL                                         $40, 'join'
        104        SEND_VAL_EX                                              'people+as+f'
        105        SEND_VAL_EX                                              'e.id'
        106        SEND_VAL_EX                                              '%3D'
        107        SEND_VAL_EX                                              'f.user_id'
        108        DO_FCALL                                      0  $41     
   49   109        INIT_METHOD_CALL                                         $41, 'where'
        110        SEND_VAL_EX                                              'c.request_status'
        111        SEND_VAR_EX                                              !4
        112        DO_FCALL                                      0  $42     
   50   113        INIT_METHOD_CALL                                         $42, 'where'
        114        SEND_VAL_EX                                              'c.request_status'
        115        SEND_VAR_EX                                              !4
        116        DO_FCALL                                      0  $43     
   51   117        INIT_METHOD_CALL                                         $43, 'where'
        118        DECLARE_LAMBDA_FUNCTION                          ~44     [1]
        119        BIND_LEXICAL                                             ~44, !0
   55   120        SEND_VAL_EX                                              ~44
   51   121        DO_FCALL                                      0  $45     
   56   122        INIT_METHOD_CALL                                         $45, 'whereBetween'
        123        SEND_VAL_EX                                              'a.creted_at'
        124        INIT_ARRAY                                       ~46     !2
        125        ADD_ARRAY_ELEMENT                                ~46     !1
        126        SEND_VAL_EX                                              ~46
        127        DO_FCALL                                      0  $47     
   57   128        INIT_METHOD_CALL                                         $47, 'where'
        129        SEND_VAL_EX                                              'e.username'
        130        SEND_VAL_EX                                              '%3C%3E'
        131        CHECK_FUNC_ARG                                           
        132        INIT_STATIC_METHOD_CALL                                  'Auth', 'user'
        133        DO_FCALL                                      0  $48     
        134        FETCH_OBJ_FUNC_ARG                               $49     $48, 'username'
        135        SEND_FUNC_ARG                                            $49
        136        DO_FCALL                                      0  $50     
   58   137        INIT_METHOD_CALL                                         $50, 'groupBy'
        138        SEND_VAL_EX                                              'a.id'
        139        SEND_VAL_EX                                              'e.id'
        140        DO_FCALL                                      0  $51     
   59   141        INIT_METHOD_CALL                                         $51, 'select'
        142        INIT_STATIC_METHOD_CALL                                  'DB', 'raw'
        143        SEND_VAL_EX                                              'concat%28f.firstname%2C+%27+%27%2C+f.lastname%29+as+name'
        144        DO_FCALL                                      0  $52     
        145        SEND_VAR_NO_REF_EX                                       $52
        146        SEND_VAL_EX                                              'e.username'
        147        SEND_VAL_EX                                              'a.published_book_title+as+title'
        148        SEND_VAL_EX                                              'a.id'
        149        DO_FCALL                                      0  $53     
   44   150        ASSIGN                                                   !6, $53
   62   151        INIT_METHOD_CALL                                         !2, 'modify'
        152        SEND_VAL_EX                                              '-1+second'
        153        DO_FCALL                                      0          
   64   154        INIT_METHOD_CALL                                         !6, 'count'
        155        DO_FCALL                                      0  $56     
        156        IS_SMALLER                                               0, $56
        157      > JMPZ                                                     ~57, ->162
   65   158    >   INIT_METHOD_CALL                                         !6, 'get'
        159        DO_FCALL                                      0  $59     
        160        ASSIGN_DIM                                               !5, 'published_books2'
        161        OP_DATA                                                  $59
   74   162    > > 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/dJaUY
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $query, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   22     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          
   23     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/dJaUY
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $query, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   53     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      
   54     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          
   55    14      > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.36 ms | 1024 KiB | 13 Q