3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bar { public static function foo($data) { return $data; } } class post { public static function respond($status, $values = NULL) { if($values != NULL){ echo json_encode(['status' => $status, 'values' => $values]); return true; }else{ echo json_encode(['status' => $status]); return true; } return false; } public static function respond_catch($function, $parameters_array) { try{ $values = call_user_func_array($function_name, $parameters_array); } catch(Exception $e) { if($e->getMessage() != NULL ){ //There is a message echo json_encode(['status' => $default_message]); return false; }else{ //otherwise echo json_encode(['status' => 'Nastala chyba. Skúste to znova prosím.']); return false; } } echo json_encode(['status' => 'OK', 'values' => $values]); return true; } } $data = ['some','data']; post::respond_catch('bar:foo', [$data]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c2FAf
function name:  (null)
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   ASSIGN                                                   !0, <array>
   48     1        INIT_STATIC_METHOD_CALL                                  'post', 'respond_catch'
          2        SEND_VAL                                                 'bar%3Afoo'
          3        INIT_ARRAY                                       ~2      !0
          4        SEND_VAL                                                 ~2
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class bar:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c2FAf
function name:  foo
number of ops:  3
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1      > RETURN                                                   !0
    7     2*     > RETURN                                                   null

End of function foo

End of class bar.

Class post:
Function respond:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c2FAf
function name:  respond
number of ops:  20
compiled vars:  !0 = $status, !1 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   14     2        IS_NOT_EQUAL                                             !1, null
          3      > JMPZ                                                     ~2, ->12
   15     4    >   INIT_FCALL                                               'json_encode'
          5        INIT_ARRAY                                       ~3      !0, 'status'
          6        ADD_ARRAY_ELEMENT                                ~3      !1, 'values'
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9        ECHO                                                     $4
   16    10      > RETURN                                                   <true>
         11*       JMP                                                      ->18
   18    12    >   INIT_FCALL                                               'json_encode'
         13        INIT_ARRAY                                       ~5      !0, 'status'
         14        SEND_VAL                                                 ~5
         15        DO_ICALL                                         $6      
         16        ECHO                                                     $6
   19    17      > RETURN                                                   <true>
   22    18*       RETURN                                                   <false>
   23    19*     > RETURN                                                   null

End of function respond

Function respond_catch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c2FAf
function name:  respond_catch
number of ops:  33
compiled vars:  !0 = $function, !1 = $parameters_array, !2 = $values, !3 = $function_name, !4 = $e, !5 = $default_message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        INIT_USER_CALL                                0          'call_user_func_array', !3
          3        SEND_ARRAY                                               !1
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !2, $6
          7      > JMP                                                      ->25
   29     8  E > > CATCH                                       last         'Exception'
   30     9    >   INIT_METHOD_CALL                                         !4, 'getMessage'
         10        DO_FCALL                                      0  $8      
         11        IS_NOT_EQUAL                                             $8, null
         12      > JMPZ                                                     ~9, ->20
   32    13    >   INIT_FCALL                                               'json_encode'
         14        INIT_ARRAY                                       ~10     !5, 'status'
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                         $11     
         17        ECHO                                                     $11
   33    18      > RETURN                                                   <false>
         19*       JMP                                                      ->25
   36    20    >   INIT_FCALL                                               'json_encode'
         21        SEND_VAL                                                 <array>
         22        DO_ICALL                                         $12     
         23        ECHO                                                     $12
   37    24      > RETURN                                                   <false>
   41    25    >   INIT_FCALL                                               'json_encode'
         26        INIT_ARRAY                                       ~13     'OK', 'status'
         27        ADD_ARRAY_ELEMENT                                ~13     !2, 'values'
         28        SEND_VAL                                                 ~13
         29        DO_ICALL                                         $14     
         30        ECHO                                                     $14
   42    31      > RETURN                                                   <true>
   43    32*     > RETURN                                                   null

End of function respond_catch

End of class post.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.64 ms | 1400 KiB | 15 Q