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){ echo json_encode(['status' => $status, 'values' => $values]); return true; }else{ echo json_encode(['status' => $status]); return true; } } public static function respond_catch($function_name, $parameters_array) { try{ $values = call_user_func_array($function_name, $parameters_array); } catch(Exception $e) { if($e->getMessage() != NULL ){ //There is a message self::respond($e->getMessage()); return false; }else{ self::respond('Nastala chyba. Skúste to znova prosím.'); return false; } } self::respond('OK', $values); } } $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/KDcNs
function name:  (null)
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   ASSIGN                                                   !0, <array>
   44     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/KDcNs
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 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDcNs
function name:  respond
number of ops:  18
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      > JMPZ                                                     !1, ->11
   15     3    >   INIT_FCALL                                               'json_encode'
          4        INIT_ARRAY                                       ~2      !0, 'status'
          5        ADD_ARRAY_ELEMENT                                ~2      !1, 'values'
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8        ECHO                                                     $3
   16     9      > RETURN                                                   <true>
         10*       JMP                                                      ->17
   18    11    >   INIT_FCALL                                               'json_encode'
         12        INIT_ARRAY                                       ~4      !0, 'status'
         13        SEND_VAL                                                 ~4
         14        DO_ICALL                                         $5      
         15        ECHO                                                     $5
   19    16      > RETURN                                                   <true>
   21    17*     > RETURN                                                   null

End of function respond

Function respond_catch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
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/KDcNs
function name:  respond_catch
number of ops:  29
compiled vars:  !0 = $function_name, !1 = $parameters_array, !2 = $values, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2        INIT_USER_CALL                                0          'call_user_func_array', !0
          3        SEND_ARRAY                                               !1
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !2, $4
          7      > JMP                                                      ->24
   27     8  E > > CATCH                                       last         'Exception'
   28     9    >   INIT_METHOD_CALL                                         !3, 'getMessage'
         10        DO_FCALL                                      0  $6      
         11        IS_NOT_EQUAL                                             $6, null
         12      > JMPZ                                                     ~7, ->20
   30    13    >   INIT_STATIC_METHOD_CALL                                  'respond'
         14        INIT_METHOD_CALL                                         !3, 'getMessage'
         15        DO_FCALL                                      0  $8      
         16        SEND_VAR                                                 $8
         17        DO_FCALL                                      0          
   31    18      > RETURN                                                   <false>
         19*       JMP                                                      ->24
   33    20    >   INIT_STATIC_METHOD_CALL                                  'respond'
         21        SEND_VAL                                                 'Nastala+chyba.+Sk%C3%BAste+to+znova+pros%C3%ADm.'
         22        DO_FCALL                                      0          
   34    23      > RETURN                                                   <false>
   38    24    >   INIT_STATIC_METHOD_CALL                                  'respond'
         25        SEND_VAL                                                 'OK'
         26        SEND_VAR                                                 !2
         27        DO_FCALL                                      0          
   39    28      > RETURN                                                   null

End of function respond_catch

End of class post.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.43 ms | 1400 KiB | 15 Q