3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait AssignHandler { public function __call($name, $args) { if(preg_match("#^set([A-Z][a-zA-Z0-9_]+?)$#", $name, $matches)) { $property = strtolower($matches[1]); if(property_exists($this, $property)) { $this->{$property} = $args[0] ?? null; } } return $this; } } class Post { use AssignHandler; public $title; public $content; } $post = new Post; $post->setTitle("Value") ->setContent("example content"); print_r($post);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kEIKJ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $post
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   DECLARE_CLASS                                            'post'
   26     1        NEW                                              $1      'Post'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   27     4        INIT_METHOD_CALL                                         !0, 'setTitle'
          5        SEND_VAL_EX                                              'Value'
          6        DO_FCALL                                      0  $4      
   28     7        INIT_METHOD_CALL                                         $4, 'setContent'
          8        SEND_VAL_EX                                              'example+content'
          9        DO_FCALL                                      0          
   30    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class AssignHandler:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 24
filename:       /in/kEIKJ
function name:  __call
number of ops:  27
compiled vars:  !0 = $name, !1 = $args, !2 = $matches, !3 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%23%5Eset%28%5BA-Z%5D%5Ba-zA-Z0-9_%5D%2B%3F%29%24%23'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $4      
          7      > JMPZ                                                     $4, ->24
    8     8    >   INIT_FCALL                                               'strtolower'
          9        FETCH_DIM_R                                      ~5      !2, 1
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !3, $6
    9    13        INIT_FCALL                                               'property_exists'
         14        FETCH_THIS                                       ~8      
         15        SEND_VAL                                                 ~8
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $9      
         18      > JMPZ                                                     $9, ->24
   10    19    >   FETCH_DIM_IS                                     ~11     !1, 0
         20        COALESCE                                         ~12     ~11
         21        QM_ASSIGN                                        ~12     null
         22        ASSIGN_OBJ                                               !3
         23        OP_DATA                                                  ~12
   14    24    >   FETCH_THIS                                       ~13     
         25      > RETURN                                                   ~13
   15    26*     > RETURN                                                   null

End of function __call

End of class AssignHandler.

Class Post: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.23 ms | 1013 KiB | 17 Q