3v4l.org

run code in 300+ PHP versions simultaneously
<?php class JsonSerializer { public static function serialize($value) { var_dump($value); } public function __call($method, $args) { if ('serialize' !== strtolower($method)) { throw new \BadMethodCallException('Call to undefined method '.__METHOD__); } return self::serialize(...$args); } } JsonSerializer::serialize('foo'); (new JsonSerializer())->serialize('bar'); try { (new JsonSerializer())->baz('qux'); } catch (\Exception $e) { var_dump($e->getMessage()); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GDQ0l
function name:  (null)
number of ops:  21
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'JsonSerializer', 'serialize'
          1        SEND_VAL                                                 'foo'
          2        DO_FCALL                                      0          
   21     3        NEW                                              $2      'JsonSerializer'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $2, 'serialize'
          6        SEND_VAL_EX                                              'bar'
          7        DO_FCALL                                      0          
   24     8        NEW                                              $5      'JsonSerializer'
          9        DO_FCALL                                      0          
         10        INIT_METHOD_CALL                                         $5, 'baz'
         11        SEND_VAL_EX                                              'qux'
         12        DO_FCALL                                      0          
         13      > JMP                                                      ->20
   25    14  E > > CATCH                                       last         'Exception'
   26    15    >   INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !0, 'getMessage'
         17        DO_FCALL                                      0  $8      
         18        SEND_VAR                                                 $8
         19        DO_ICALL                                                 
   27    20    > > RETURN                                                   1

Class JsonSerializer:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GDQ0l
function name:  serialize
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function serialize

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GDQ0l
function name:  __call
number of ops:  17
compiled vars:  !0 = $method, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        IS_NOT_IDENTICAL                                         $2, 'serialize'
          6      > JMPZ                                                     ~3, ->11
   13     7    >   NEW                                              $4      'BadMethodCallException'
          8        SEND_VAL_EX                                              'Call+to+undefined+method+JsonSerializer%3A%3A__call'
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $4
   16    11    >   INIT_STATIC_METHOD_CALL                                  'serialize'
         12        SEND_UNPACK                                              !1
         13        CHECK_UNDEF_ARGS                                         
         14        DO_FCALL                                      1  $6      
         15      > RETURN                                                   $6
   17    16*     > RETURN                                                   null

End of function __call

End of class JsonSerializer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.72 ms | 1400 KiB | 17 Q